Clarify the transition plan for the 2to3 fixer. Also link directly to the

fixer itself.
This commit is contained in:
Brett Cannon 2007-03-20 21:47:44 +00:00
parent 1c68c46409
commit 34e9d0f39f
1 changed files with 20 additions and 7 deletions

View File

@ -216,13 +216,12 @@ emitted when Python's compiler comes across a tuple parameter in
Python 2.6. This will be treated like any other syntactic change that
is to occur in Python 3.0 compared to Python 2.6.
Second, the 2to3 refactoring tool [#2to3]_ will gain a rule for
translating tuple parameters to being a single parameter that is
unpacked as the first statement in the function. The name of the new
parameter will be a mangling of tuple parameter's names by joining
them with underscores. The new parameter will then be unpacked into
the names originally used in the tuple parameter. This means that the
following function::
Second, the 2to3 refactoring tool [#2to3]_ will gain a fixer
[#fixer]_ for translating tuple parameters to being a single parameter
that is unpacked as the first statement in the function. The name of
the new parameter will be changed. The new parameter will then be
unpacked into the names originally used in the tuple parameter. This
means that the following function::
def fxn((a, (b, c))):
pass
@ -233,6 +232,17 @@ will be translated into::
(a, (b, c)) = a_b_c
pass
As tuple parameters are used by lambdas because of the single
expression limitation, they must also be supported. This is done by
having the expected sequence argument bound to a single parameter and
then indexing on that parameter::
lambda (x, y): x + y
will be translated into::
lambda x_y: x_y[0] + x_y[1]
References
==========
@ -240,6 +250,9 @@ References
.. [#2to3] 2to3 refactoring tool
(http://svn.python.org/view/sandbox/trunk/2to3/)
.. [#fixer] 2to3 fixer
(http://svn.python.org/view/sandbox/trunk/2to3/fixes/fix_tuple_params.py)
.. [#ironpython] IronPython
(http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython)