Hello,

On Tue, 15 Dec 2020 23:37:59 +1300
Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:

> On 15/12/20 10:04 pm, Paul Sokolovsky wrote:
> > Example 1:
> > 
> > a + b + c   vs   a + (b + c)
> > 
> > Question 1:
> > Do you agree that there's a clear difference between left and right
> > expression?  
> 
> Yes, because the default order of operations in Python is defined
> so that a + b + c is the same as (a + b) + c.
> 
> > Example 2:
> > 
> > a.b()   vs   (a.b)()
> > 
> > Question 2:
> > Do you agree that there's a *similar* difference here as in Example
> > 1?  
> 
> No, because the default order of operations here already has
> a.b evaluated before making the call, so adding the parentheses
> changes nothing.

That's good answer, thanks. But... it doesn't correspond to the
implementation reality. As I showed right in my first mail, in "a.b()",
"a.b" doesn't get evaluated at all (since CPython3.7). Instead,
something completely different gets evaluated. Ok, not "completely", but
"sufficiently" different. We can continue to beat on the side of "it's
only a bytecode optimization, there's total disconnection between what
happens in the compiled bytecode and the language syntax". But what if
not?


> -- 
> Greg


-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
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/CJIZHSV35NIYYOM74VWXK35NUE6ELKUV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to