True == 1 weirdness

Grant Edwards invalid at invalid.invalid
Wed Sep 16 13:46:45 EDT 2015


On 2015-09-16, Steven D'Aprano <steve at pearwood.info> wrote:
> 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:

In my experience, that just doesn't happen.  Yes, they can be
overloaded, but doing that and then chaining them isn't going to make
sense to anybody but the author (and temporarily even then).

> node = left <= ptr => right

Exactly. I've no clue what that means.  ;)

-- 
Grant Edwards               grant.b.edwards        Yow! Zippy's brain cells
                                  at               are straining to bridge
                              gmail.com            synapses ...



More information about the Python-list mailing list