True == 1 weirdness

Marko Rauhamaa marko at pacujo.net
Wed Sep 16 12:16:45 EDT 2015


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.


Marko



More information about the Python-list mailing list