> I don't recall Guido's patch. Did he modify the grammar or can it > all be done inside the compiler? The parser generator is too weak to allow a grammar change to work, so I did it in the compiler. > Not that it's practical for 2.4, but I > think it wouldn't be hard to post-process the existing AST to > recognize decorators written like this. > > You'd like for adjacent statements of the form: > Expr(List()) > FunctionDef() > and replace them with a single > FunctionDef() > > Or do we need to catch Expr(ListComp()) too? PEP 318 doesn't mention > semantics anywhere, so it doesn't say what is allowed inside the > square brackets. My patch excludes list comprehensions, because I need to know the number of elements of the list for the code I generate. The PEP should be disambiguated to disallow list comps. (I see no merit to the import hook + bytecode hack approach.) --Guido van Rossum (home page: http://www.python.org/~guido/)
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