Update of PEP 318, by Jim Jewett.

This commit is contained in:
Georg Brandl 2007-05-02 07:14:15 +00:00
parent bdb8407da1
commit 09d0fc1583
1 changed files with 19 additions and 4 deletions

View File

@ -50,7 +50,7 @@ This becomes less readable with longer methods. It also seems less
than pythonic to name the function three times for what is conceptually
a single declaration. A solution to this problem is to move the
transformation of the method closer to the method's own declaration.
While the new syntax is not yet final, the intent is to replace::
The intent of the new syntax is to replace ::
def foo(cls):
pass
@ -72,6 +72,8 @@ using metaclasses is sufficiently obscure that there is some attraction
to having an easier way to make simple modifications to classes. For
Python 2.4, only function/method decorators are being added.
PEP 3129 [#PEP-3129] proposes to add class decorators as of Python 2.6.
Why Is This So Hard?
--------------------
@ -322,7 +324,8 @@ There have been a number of objections raised to this location -- the
primary one is that it's the first real Python case where a line of code
has an effect on a following line. The syntax available in 2.4a3
requires one decorator per line (in a2, multiple decorators could be
specified on the same line).
specified on the same line), and the final decision for 2.4 final stayed
one decorator per line.
People also complained that the syntax quickly got unwieldy when
multiple decorators were used. The point was made, though, that the
@ -820,8 +823,8 @@ Of course, all these examples are possible today, though without
syntactic support.
Open Issues
===========
(No longer) Open Issues
=======================
1. It's not yet certain that class decorators will be incorporated
into the language at a future point. Guido expressed skepticism about
@ -833,9 +836,21 @@ Open Issues
.. _strong arguments:
http://mail.python.org/pipermail/python-dev/2004-March/thread.html
PEP 3129 [#PEP-3129] proposes to add class decorators as of Python 2.6.
2. The choice of the ``@`` character will be re-examined before
Python 2.4b1.
In the end, the ``@`` character was kept.
References
==========
.. [#PEP-3129] PEP 3129, "Class Decorators", Winter
http://www.python.org/dev/peps/pep-3129
Copyright
=========