[Python-Dev] PEP 492 vs. PEP 3152, new round (original) (raw)
Yury Selivanov yselivanov.ml at gmail.com
Wed Apr 29 07:47:44 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Next message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg,
On 2015-04-29 1:40 AM, Greg Ewing wrote:
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?
Sorry, I thought you meant parsing "await a()*b()" as "await (a() * b())".
I don't think your currently proposed grammar prevents that anyway. We can have --> '*' --> '*' --> '*' --> 'await' * '' --> 'await' 'a' '(' ')' '*' 'b' '(' ')' It does, on the other hand, seem to prevent x = - await a()
This works just fine: https://github.com/1st1/cpython/commit/33b3cd052243cd71c064eb385c7a557eec3ced4b
Current grammar prevents this: "await -fut", and this: "await fut ** 2" being parsed as "await (fut ** 2)
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!).
It's just like unary minus ;)
Yury
- Previous message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Next message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]