What values are considered false?

Jeff Henry jhenry19 at ford.com
Thu Feb 21 11:27:22 EST 2002


Roy Smith wrote:
> 
> Roy Smith <roy at panix.com> wrote:
> > PS -- In the lists of false things in python that have been mentioned on
> > this thread, I don't think I've seen anybody mention {}, the empty
> > dictionary.
> 
> Along those same lines, I half-expected the empty function to be false,
> i.e.:
> 
> def foo():
>    pass
> 
> if (foo):

Oops! I think you meant to say -

if (foo()):

>    print "it's true"
> else:
>    print "it's false"
> 
> should have printed "it's false".  Alas, it says it's true.  Seems kind of
> irregular to me, not that I would imagine there's much practical
> consequence one way or the other.



More information about the Python-list mailing list