True == 1 weirdness

Marko Rauhamaa marko at pacujo.net
Thu Sep 17 17:38:34 EDT 2015


Random832 <random832 at fastmail.com>:

> It being *easier to implement* to have comparison operators be a
> single class and have chaining apply equally to all of them may be an
> excuse for the language to allow it, but it's certainly not an excuse
> for *actually* using it from a standpoint of good style and
> readability.

In general, I don't like such caveats. Either something is in the
language or it is not.

You don't have to use all language features (I certainly don't), but if
somebody takes advantage of them, you shouldn't consider it bad style.
So if you don't like

    if prev_node is not node in excluded:
         ...

take your complaints to whoever accepted the syntax in the language.


Marko



More information about the Python-list mailing list