On Fri, Apr 13, 2018 at 2:14 PM, David Mertz <me...@gnosis.cx> wrote:
> Yes, I have not read all the iterations of the PEP, and none of them
> extremely closely. I had thought it "obvious" that ':=' should have a very
> high operator precedence. But of course if it doesn't then expressions like
> the one I proposed could mean something quite different.

Interesting. How high, exactly?


(note: "higher precedence" doesn't mean higher on that table - the
table's from lowest to highest)

Currently, I've placed ':=' up with if-else expressions. That's
extremely low precedence. I'm contemplating moving it to just higher
than comparison operators (ie just below the bitwise operators),
putting it below all the arithmetic operators. The highest precedence
I would consider putting it is just below the unary operators; that
would mean it binds more tightly than arithmetic operators, but you
can still say "x := y[1]" without having to parenthesize the latter.

foo := a > b   # does this capture 'a', or 'a > b'?
bar := c + d   # 'c' or 'c + d'?

I'm open to argument here, but my thinking is that these should
capture 'a' and 'c + d'.

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to