Tell me the truth
Duncan Booth
duncan.booth at invalid.invalid
Thu Mar 8 11:25:55 EST 2007
francois.petitjean at bureauveritas.com wrote:
> After much head scrating and experimenting with dis.dis() I have found
> that chaining comparisons (with is or ==) a == b == c in Python is
> never a good idea. It is interpreted as
> ( a == b ) and ( b == c)
> Such a magic is fine when we write:
> if 0.0 <= x < 1.0:
> but it renders the outcome of if a == b == c: somewhat confusing.
I don't understand why it is confusing. What other meaning would you
expect?
More information about the Python-list
mailing list