whitespace
This commit is contained in:
parent
059a87e6e4
commit
753c085617
44
pep-0318.txt
44
pep-0318.txt
|
@ -9,16 +9,16 @@ Content-Type: text/x-rst
|
|||
Created: 05-Jun-2003
|
||||
Python-Version: 2.4
|
||||
Post-History: 09-Jun-2003, 10-Jun-2003, 27-Feb-2004, 23-Mar-2004, 30-Aug-2004,
|
||||
2-Sep-2004
|
||||
2-Sep-2004
|
||||
|
||||
|
||||
WarningWarningWarning
|
||||
=====================
|
||||
|
||||
This document is meant to describe the decorator syntax and the
|
||||
process that resulted in the decisions that were made. It does not
|
||||
attempt to cover the huge number of potential alternative syntaxes,
|
||||
nor is it an attempt to exhaustively list all the positives and
|
||||
process that resulted in the decisions that were made. It does not
|
||||
attempt to cover the huge number of potential alternative syntaxes,
|
||||
nor is it an attempt to exhaustively list all the positives and
|
||||
negatives of each form.
|
||||
|
||||
|
||||
|
@ -144,12 +144,12 @@ The discussion continued on and off on python-dev from February
|
|||
2002 through July 2004. Hundreds and hundreds of posts were made,
|
||||
with people proposing many possible syntax variations. Guido took
|
||||
a list of proposals to `EuroPython 2004`_, where a discussion took
|
||||
place. Subsequent to this, he decided that we'd have the `Java-style`_
|
||||
@decorator syntax, and this appeared for the first time in 2.4a2.
|
||||
Barry Warsaw named this the 'pie-decorator' syntax, in honor of the
|
||||
Pie-thon Parrot shootout which was occured around the same time as
|
||||
the decorator syntax, and because the @ looks a little like a pie.
|
||||
Guido `outlined his case`_ on Python-dev, including `this piece`_
|
||||
place. Subsequent to this, he decided that we'd have the `Java-style`_
|
||||
@decorator syntax, and this appeared for the first time in 2.4a2.
|
||||
Barry Warsaw named this the 'pie-decorator' syntax, in honor of the
|
||||
Pie-thon Parrot shootout which was occured around the same time as
|
||||
the decorator syntax, and because the @ looks a little like a pie.
|
||||
Guido `outlined his case`_ on Python-dev, including `this piece`_
|
||||
on some of the (many) rejected forms.
|
||||
|
||||
.. _EuroPython 2004:
|
||||
|
@ -293,7 +293,7 @@ syntax used in 2.4a2::
|
|||
|
||||
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
|
||||
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).
|
||||
|
||||
|
@ -446,9 +446,9 @@ Syntax forms
|
|||
def foo(arg1,arg2):
|
||||
pass
|
||||
|
||||
[accepts(int,int), returns(float)]
|
||||
def bar(low,high):
|
||||
pass
|
||||
[accepts(int,int), returns(float)]
|
||||
def bar(low,high):
|
||||
pass
|
||||
|
||||
The major objection to the list syntax is that it's currently
|
||||
meaningful (when used in the form before the method). It's also
|
||||
|
@ -461,8 +461,8 @@ Syntax forms
|
|||
pass
|
||||
|
||||
<accepts(int,int), returns(float)>
|
||||
def bar(low,high):
|
||||
pass
|
||||
def bar(low,high):
|
||||
pass
|
||||
|
||||
None of these alternatives gained much traction. The alternatives
|
||||
which involve square brackets only serve to make it obvious that the
|
||||
|
@ -539,7 +539,7 @@ Syntax forms
|
|||
.. _the full response:
|
||||
http://mail.python.org/pipermail/python-dev/2004-September/048518.html
|
||||
|
||||
* Other forms
|
||||
* Other forms
|
||||
|
||||
There are plenty of other variants and proposals on `the wiki page`_.
|
||||
|
||||
|
@ -573,7 +573,7 @@ Current Implementation, History
|
|||
===============================
|
||||
|
||||
Guido asked for a volunteer to implement his preferred syntax, and Mark
|
||||
Russell stepped up and posted a `patch`_ to SF. This new syntax was
|
||||
Russell stepped up and posted a `patch`_ to SF. This new syntax was
|
||||
available in 2.4a2. ::
|
||||
|
||||
@dec2
|
||||
|
@ -667,7 +667,7 @@ Sparks produced `a patch`_.
|
|||
|
||||
.. _detailed proposal:
|
||||
http://www.aminus.org/rbre/python/pydec.html
|
||||
.. _a patch:
|
||||
.. _a patch:
|
||||
http://www.python.org/sf/1013835
|
||||
|
||||
As noted previously, Guido rejected this form, outlining his problems
|
||||
|
@ -732,7 +732,7 @@ use.
|
|||
def mymethod(f):
|
||||
...
|
||||
|
||||
4. Enforce function argument and return types. Note that this
|
||||
4. Enforce function argument and return types. Note that this
|
||||
copies the func_name attribute from the old to the new function.
|
||||
func_name was made writable in Python 2.4a3::
|
||||
|
||||
|
@ -799,13 +799,13 @@ Open Issues
|
|||
into the language at a future point. Guido expressed skepticism about
|
||||
the concept, but various people have made some `strong arguments`_
|
||||
(search for ``PEP 318 -- posting draft``) on their behalf in
|
||||
``python-dev``. It's exceedingly unlikely that class decorators
|
||||
``python-dev``. It's exceedingly unlikely that class decorators
|
||||
will be in Python 2.4.
|
||||
|
||||
.. _strong arguments:
|
||||
http://mail.python.org/pipermail/python-dev/2004-March/thread.html
|
||||
|
||||
2. The choice of the ``@`` character will be re-examined before
|
||||
2. The choice of the ``@`` character will be re-examined before
|
||||
Python 2.4b1.
|
||||
|
||||
Copyright
|
||||
|
|
Loading…
Reference in New Issue