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 > > <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() 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4