if the else short form

Ian ian.g.kelly at gmail.com
Sat Oct 2 03:47:26 EDT 2010


On Oct 1, 11:19 pm, Paul Rubin <no.em... at nospam.invalid> wrote:
> Steven D'Aprano <st... at REMOVE-THIS-cybersource.com.au> writes:
> > Incorrect. bools *are* ints in Python, beyond any doubt.
>
>     Python 2.6.2 (r262:71600, Jun  4 2010, 18:28:58)
>     >>> type(3)==type(True)
>     False

>>> -1 < False < True < 2
True

>>> True + True
2

>>> hex(True)
'0x1'

>>> True.real, True.imag
(1, 0)

If it looks like a duck, swims like a duck, and quacks like a duck...



More information about the Python-list mailing list