True == 1 weirdness
random832 at fastmail.com
Wed Sep 16 18:57:52 CEST 2015
On Wed, Sep 16, 2015, at 12:37, Sven R. Kunze wrote:
> I like it for x < y < z.
> But I agree more than this often helps confusion more than it helps
I think that chaining should be limited to:
A) all operators are "="
B) all operators are "is"
C) all operators are either >= or >
D) all operators are either <= or <
There's no other scenario, if the operators have natural meanings, that
it would actually be natural to write it that way. (Actually, I'm not
entirely convinced any harm would be done by allowing you to put "is"/=
anywhere, but there certainly shouldn't be opposite direction
comparisons, "is not", !=, or "in".)
Certainly I think this should be enforced by any sort of lint tool, even
if the other uses are not actually removed from the language. I also
think it should be part of PEP 8.
More information about the Python-list