Yury Selivanov wrote:

I don't want this: "await a() * b()" to be parsed, it's not meaningful.

Why not? If a() is a coroutine that returns a number,
why shouldn't I be able to multiply it by something?

I don't think your currently proposed grammar prevents
that anyway. We can have

<expr> --> <factor> '*' <factor>
   --> <power> '*' <power>
   --> <atom_expr> '*' <atom_expr>
   --> 'await' <atom> <trailer>* '*' <atom> <trailer>*
   --> 'await' 'a' '(' ')' '*' 'b' '(' ')'

It does, on the other hand, seem to prevent

  x = - await a()

which looks perfectly sensible to me.

I don't like the idea of introducing another level
of precedence. Python already has too many of those
to keep in my brain. Being able to tell people "it's
just like unary minus" makes it easy to explain (and
therefore possibly a good idea!).

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to