At 06:50 PM 3/11/04 -0500, Jewett, Jim J wrote: >---------- >class Foo: > [transform] from: > def x(): > pass > >[wrapper] from: > class x: > pass > >[decorator] from: > def x(): > pass > >x() is now defined exactly as it was before, >except that it has an extra indent to the right. > >--------- > >I understand most of the objections well enough to >summarize them; I'm singling these out because I'm >not sure I that I do. > >Phillip J. Eby: > > > It is ambiguous precisely *because* it introduces a new suite. > > Suites in Python indicate a difference in execution context, > > often along with introducing a new namespace. This new syntax > > does neither. > >Today, if we wait until the declaration is finished, we can write > > for decorator in seq: > var = decorator(var) > >How does this construct change the context or namespace any less >than a for loop? In your proposal, the function definition is nested, but its execution context and namespace are unchanged. The presence of a suite implies that either the control flow or the namespace (or both) are affected, but your proposed syntax affects neither.
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