True == 1 weirdness

Sven R. Kunze srkunze at mail.de
Wed Sep 16 12:37:47 EDT 2015


On 16.09.2015 18:16, Marko Rauhamaa wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Far as I can see, the only operator that you might want to disallow
>> chaining on is 'in' (and its mate 'not in', of course). It isn't
>> common, but "x is y is z is None" is a perfectly reasonable way to
>> ascertain whether or not they're all None, just as "x = y = z = None"
>> is a perfectly reasonable way to set them all to None;
> Then you can have:
>
>     first_node is not node is not last_node
>
> No, seriously, that's not reasonable.
>
> Frankly, I don't think chaining was all that great of an idea.

I like it for x < y < z.

But I agree more than this often helps confusion more than it helps clarity.

>
> Marko




More information about the Python-list mailing list