Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38060>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to