and becomes or and or becomes and
Tim Roberts
timr at probo.com
Sun May 22 18:39:33 EDT 2011
Stef Mientki <stef.mientki at gmail.com> wrote:
>
>must of us will not use single bits these days,
>but at first sight, this looks funny :
>
>>>> a=2
>>>> b=6
>>>> a and b
>6
>>>> a & b
>2
>>>> a or b
>2
>>>> a | b
>6
That IS funny. Interesting how a careful choice of arugments will fool us.
One of my favorite math jokes is like that. A teacher asked a student to
reduce the following fraction:
16
----
64
He says "all I have to do is cancel out the sixes, so the answer is 1/4".
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list