[Python-Dev] PEP 318: Suggest we drop it
Brett C.
bac at OCF.Berkeley.EDU
Thu Aug 19 00:26:12 CEST 2004
Kevin J. Butler wrote:
> - There is no universally liked syntax (or even a universally
> _tolerable_ syntax)
Yeah, but this happens every time a new syntax is proposed.
> - decorators will incosistently retain or drop docstrings (this may even
> be the most appropriate thing to do)
No one ever said decorators were for newbies. There are multiple things
to take into consideration when designing them.
> - a "decorated" function may have an arbitrarily distant relationship
> with the function as implemented in the def statement (this is a killer)
Why? The decorator is listed before you even reach the def statement so
you know how its semantics will change.
> - if you want to decorate a single function two separate ways, you're
> back to 2.3 syntax - say, one that logs, checks parameters, etc., and
> the "internal" optimal version. None of the decorator syntaxes
> facilitate this.
>
Yeah, but hardly any of the other suggestions do either. And I don't
think this 'one function, two separate decorators' will be common enough
to warrant requiring it for the syntax.
> Because of all these issues, I think we should drop PEP 318.
>
I disagree. I honestly think a bunch of people jumped the gun on this.
Initially I wasn't crazy about the syntax either, but then I rewrote
one of the test cases for test_decorators and I completely changed my
mind. While I am not saying even the majority of people would change
their mind if they used the syntax I do think a decent chunk of people
would.
And I think people need to realize that there is precedent for having
this syntactically supported. Both Java and C#, while not my favorite
languages, both have something like this. It would suggest that there
is *something* to this if two separate language teams came up with
supporting this all while we had our own non-syntactic support.
> The 2.3 form seems more reasonable all the time:
>
Then use it and not the new syntax. This is not meant to come off as
snippy, but part of the cool thing about all of this is you can
*still* use the 2.2 style (I am going all the way back to the first
version that supported descriptors and thus introduced this whole idea
of decorators).
After all of this, I think it is time to stop arguing over new syntax
here or suggesting we drop it. Not enough people don't want the feature
to convince Guido to drop it. Right now people should be hashing things
out on c.l.py to get down to one alternative to propose to Guido (which
I think is rather nice of him since he doesn't have to listen to anybody
on any of this). Everything else has just turned into white noise at
this point.
And this is my final email on alternative decorators until that single
alternative for Guido comes forth since that is the only acceptable next
step.
-Brett
More information about the Python-Dev
mailing list