This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients sangeetamchauhan, steven.daprano, tim.peters
Date 2019-09-10.23:54:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20190910235430.GU6274@ando.pearwood.info>
In-reply-to <1568134179.42.0.739555265669.issue38060@roundup.psfhosted.org>
Content
I think that the problem is that the precedence table may be technically 
correct, but it doesn't describe the actual behaviour of expressions 
including the boolean operators ``or`` and ``and`` for exactly the 
reason Tim gives:

> Precedence rules alone are too feeble to capture that.

If I didn't know that boolean operators short-circuited, I too would 
have expected that an expression like ``9 or 7 < "str"`` would have 
raised an exception.

The documentation (precedence table) isn't wrong, it's just incomplete. 
The information needed exists, but it is elsewhere, and if you don't 
already know it, you don't know that you need to look for it.

I think that the precedence table could do with a footnote on the two 
boolean operators describing their interaction with short-circuiting 
behaviour and linking back to the relevant section 6.11.

https://docs.python.org/3/reference/expressions.html#boolean-operations
History
Date User Action Args
2019-09-10 23:54:36steven.dapranosetrecipients: + steven.daprano, tim.peters, sangeetamchauhan
2019-09-10 23:54:36steven.dapranolinkissue38060 messages
2019-09-10 23:54:36steven.dapranocreate