Einstein summation notation

MRAB python at mrabarnett.plus.com
Fri Jul 17 11:09:03 EDT 2009


koranthala wrote:
>> 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
> option.
> 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
> one.

Python did always have True and False.



More information about the Python-list mailing list