On Tue, Dec 15, 2020 at 9:22 PM Paul Sokolovsky <pmis...@gmail.com> wrote:
> On Tue, 15 Dec 2020 20:17:37 +1100
> Chris Angelico <ros...@gmail.com> wrote:
>
> > On Tue, Dec 15, 2020 at 8:04 PM Paul Sokolovsky <pmis...@gmail.com>
> > wrote:
> > > So, let's try simple yes/no questions:
> > >
> > > 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/no.
> >
> > Yes, there is a difference.
> >
> > > Example 2:
> > >
> > > a.b()   vs   (a.b)()
> > >
> > > Question 2:
> > > Do you agree that there's a *similar* difference here as in Example
> > > 1? Yes/no.
> >
> > No, there is no difference.
> >
> > >
> > > Then of course depending on the outcome of the last question, there
> > > would be further questions. Specifically:
> > >
> > > If yes: How to put a solid formal basis behind the difference in
> > > Example 2 (because so far we're just riding on the similarity with
> > > Example 1). And how to explain it to wider audience?
> > >
> >
> > Uhh, it's called precedence and associativity? You know that (a + b +
> > c) is equivalent to ((a + b) + c), not to (a + (b + c)). Is that
> > formal enough?
>
> Yes. But you answered "no" to the Example 2. What makes you think that
> (a + b + c) is not equivalent to (a + (b + c)), but (a.b()) is
> equivalent to ((a.b)()), that's what I'm asking.
>

Precedence and associativity? Since the two operators have the same
precedence (in this case it's the same operator twice), order of
evaluation is defined by its left-to-right associativity.

Seriously, are you actually unaware of this fundamental, or are you
playing dumb to try to make a point? I'm still trying to figure out
your point here. The parentheses in one example are changing order of
evaluation. In the other, they're not. I do not understand why this is
even a question.

I'm pretty sure most of us learned *in grade school* about BOMDAS or
BODMAS or PEMDAS or whatever mnemonic you pick. Or maybe you have to
wait till high school to learn that exponentiation is right-to-left
associative. Either way, it's not new knowledge to most programmers.

I'm done arguing, unless you actually come up with a real argument.

ChrisA
_______________________________________________
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/TIYWNVD2ZKQIZTDYPVAMGNLK4TXV5HX3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to