[Python-Dev] Decorator syntax J2 (decorate..def),
with implementation
Robert Brewer
fumanchu at amor.org
Mon Aug 16 17:19:10 CEST 2004
Michael Sparks wrote:
> Nick Coghlan> [make block optional for one decorator ?]
> Barry Warsaw> [Better, but requires keyword, and hence (?)
> __future__ ]
>
> As previously noted the arguments against the length of the
> decorator in the
> single case, I view as advantages when showing code to new users or
> maintainers.
If you allow the keyword and the single decorator on the same line, this
argument comes down to "how long is the keyword?"
>>> try: a = 3
... except Exception, x:
... print "Error", x
Nobody seems to have a problem typing "try:" again and again. I'm not
sure why "decorate:" is receiving such pessimistic scrutiny. But then, I
wasn't hanging about when try/except came into being--perhaps it had
similar difficulties.
> As for whether it's the right keyword or not, I'm not sure
> I'm qualified to
> say, but decorators seem much more like declarations of
> function properties
> in all the use cases I've seen.
The proposal, in effect, creates a declarative suite as opposed to the
more traditional imperative suite. Perhaps "declare:" would be more
appropriate (but give your brain a week to mull it over ;).
> More seriously though, if there is interest I'll see what I
> can do about cleaning up the patch to resolve the scoping issue.
I'm certainly interested; thanks for churning out an implementation.
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-Dev
mailing list