[Tutor] "if n % 2 == 0" vs. "if not n % 2" compared for speed: aesthetics lose

Hugo Arts hugo.yoshi at gmail.com
Wed Nov 24 00:29:58 CET 2010


On Tue, Nov 23, 2010 at 9:52 PM, Wayne Werner <waynejwerner at gmail.com> wrote:
>> >
>> > Did you try bitwise-and with 1?
>>
>> What's that?
>
>>>> 2 & 1
> 0
>>>> 3 & 1
> 1
>>>> 10 & 1
> 0
>>>> 11 & 1
> 0

That last one should be 1, I'd say.


More information about the Tutor mailing list