True == 1 weirdness

Grant Edwards invalid at invalid.invalid
Wed Sep 16 19:27:28 CEST 2015

On 2015-09-16, Sven R. Kunze <srkunze at> wrote:
> On 16.09.2015 18:57, 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 <
> That certainly would be a fine guideline. Only use it with all operators 
> the same.

I find that the only times I use chaining (intentionally), are in
cases C and D.  All other instances of chaining in my code are
invariably typos/bugs.

> Everything else might cause headaches.

I'm not all that sure A and B should be allowed.

> Restricting it language-wise? I don't know. I have to admit I've never 
> seen this in production anyway. Most languages I see people working with 
> don't have this feature at all. So, they don't know it exists in Python.

I use C and D intentionally, and have tripped accidentally over other

Grant Edwards               grant.b.edwards        Yow! Hey, waiter!  I want
                                  at               a NEW SHIRT and a PONY TAIL
                                with lemon sauce!

More information about the Python-list mailing list