Why not 'foo = not f' instead of 'foo = (not f or 1) and 0'?

Gary Herron gherron at islandtraining.com
Wed Jan 23 11:36:40 EST 2008


Boris Borcic wrote:
> I am surprised nobody pointed out explicitely that
>
> True==1 and False==0
>   
Several of us did indeed point this out by saying that bool's are a
subclass of ints.
> so that for instance
>
> 5*(True+True)==10
>
> and even (but implementation-dependent) :
>
> 5*(True+True) is 10
>
> BB
>
>   




More information about the Python-list mailing list