Hello,
On Tue, 15 Dec 2020 20:18:11 +1100
Chris Angelico
On Tue, Dec 15, 2020 at 8:08 PM Paul Sokolovsky
wrote: Hello,
On Mon, 14 Dec 2020 02:17:52 -0500 David Mertz
wrote: On Sun, Dec 13, 2020, 5:11 PM Paul Sokolovsky d
a + b + c vs a + (b + c)
Here, there's even no guarantee of the same result, if we have user objects with weirdly overloaded __add__().
0.1 + 0.2 + 0.3 != 0.1 + (0.2 + 0.3)
Right, thanks. But the original question was about somewhat different matter: if you agree that there's difference between "a + b + c" vs "a + (b + c)", do you agree that there's a similar in nature difference with "a.b()" vs "(a.b)()"? If no, then why? If yes, then how to explain it better? (e.g. to Python novices).
https://docs.python.org/3/reference/expressions.html#operator-precedence
No worries, that table is not complete. For example, "," (comma) is a (context-dependent) operator in Python, yet that table doesn't have explicit entry for it. Unary "*" and "**" are other context-dependent operators. (Unary "@" too.)
ChrisA
-- Best regards, Paul mailto:pmiscml@gmail.com