Names changed to protect the guilty

Gabriel Genellina gagsl-py at
Sat Oct 7 03:38:23 CEST 2006

At Friday 6/10/2006 22:02, MonkeeSage wrote:

> > The following line of lightly munged code was found in a publicly
> > available Python library...
>Yes, this violates the Holy, Inspired, Infallible Style Guide (pbuh),
>which was written by the very finger of God when the world was still in

It's not about style or being pythonic: a condition may be false, but 
not the False object itself, so writing
if something is False:
is the wrong way to test if something is false (isn't clear? :) )

 >>> def is_odd_number(n):  return n & 1
 >>> if is_odd_number(3) is False: print "3 is odd"
... else: print "3 is even"
3 is even

Gabriel Genellina
Softlab SRL 

Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!

More information about the Python-list mailing list