Einstein summation notation (was: question of style)

koranthala koranthala at gmail.com
Fri Jul 17 02:13:51 EDT 2009

> That test was designed to treat None as a boolean False, without
> noticing that numeric 0 is also treated as False and could make the
> test do the wrong thing.  This is an extremely common type of error.

Actually, I felt that 0 not being considered False would be a better
I had lot of instances where 0 is a valid value and always I had to
put checks specifically for that.
For me, None and False should be equal to False in if checks, every
thing else being considered True.

Can someone let me know why 0 is considered equal to False?
There should be real good reasons for it, only that I cannot think of

More information about the Python-list mailing list