On 22 Feb 2005 09:14:50 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > Here's yet another way to achieve the same results. This version doesn't > iterate over any bits at all:
>>>> import operator >>>> parity = [ False ] >>>> for i in range(7): > parity += map(operator.not_, parity) Very clever! :-) Picking a nit, that version iterates over *two* sets of bits. The "for" loop over each possible bit in the input values. The "map" function over the parity bits accumulated up to that point. And the "+=" operator over those same bits again. Make that *three* sets of bits. I stand humbled. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> Îâ à Îâ à c = 1 -- http://mail.python.org/mailman/listinfo/python-list