True == 1 weirdness

Steven D'Aprano steve at pearwood.info
Wed Sep 16 13:39:26 EDT 2015


On Thu, 17 Sep 2015 02:57 am, Random832 wrote:


> 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.


0 <= x < y == z

The main reason for supporting arbitrary chained operators is that they
could be overloaded and have some meaning that makes sense:

node = left <= ptr => right



-- 
Steven




More information about the Python-list mailing list