On Thu, Jul 9, 2020, at 15:32, Dominik Vilsmeier wrote:
> On 09.07.20 21:04, Ethan Furman wrote:
> > I'm having a hard time understanding this line:
> >
> >            if lower == upper is not None:
> >
> > As near as I can tell, `upper is not None` will be either True or 
> > False, meaning the condition will only ever be True if `lower` is also 
> > either True or False, and since I would not expect `lower` to ever be 
> > True or False, I expect this condition to always fail.  Am I missing 
> > something?
> >
> It's operator chaining and shorthand notation for 
> (https://docs.python.org/3/reference/expressions.html#comparisons)
> 
>      if (lower == upper) and upper is not None:

If PEP-8 does not currently forbid using the shorthand notation in cases other 
than relational/equality operators in the same general direction [e.g. A > B == 
C >= D] or like equivalence operators [E is F is G; H == I == J], I think it 
should.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JDNR63FOM2O6AKCKEW6SMSDI5VQNHMBX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to