and becomes or and or becomes and

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun May 22 20:30:37 EDT 2011


On Sun, 22 May 2011 15:39:33 -0700, Tim Roberts wrote:

> 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".

One of my favourite variations on this is by Abbott and Costello, where 
Costello proves that 13*7 = 28 in three different ways.

http://www.youtube.com/watch?v=rLprXHbn19I



-- 
Steven




More information about the Python-list mailing list