[Python-3000] 2to3 fixers
Collin Winter
collinw at gmail.com
Tue Mar 20 05:50:47 CET 2007
Hi all,
I've added two new fixers to 2to3 this weekend, plus significant new
functionality for a third:
* fix_next handles the it.next() -> next(it) transition for PEP 3114.
* fix_nonzero converts __nonzero__ to __bool__ methods, as mentioned
in PEP 3100.
* fix_tuple_params now fixes up tuple parameters in lambdas, per PEP 3113.
I have a fixer for uppercase literal modifiers (UR"..." -> ur"...")
penciled in, but I'm still waiting on a concrete PEP before I start
work. Anyone still waiting for a fixer for his/her PEP (except for
3115, which is already on my list) should let me know.
On the topic of PEPs, I'd appreciate it if all PEPs that rely on a
2to3 fixer as part of their transition plan could mention exactly
which fixer belongs to that PEP. This helps match up fixers and PEPs,
and it also keeps me from reading a PEP and having to worry if I've
forgotten about a fixer I was supposed to write : ) These PEPs should
also include a link to 2to3
(http://svn.python.org/view/sandbox/trunk/2to3/) so people reading the
PEP can find the tool easily.
Relatedly, it would greatly help me -- and, I imagine, others -- if
new and existing PEPs could state exactly what they want their 2to3
fixer to do. Picking on PEP 3115 only because I have it open, saying
""'alternatively, it would not be too difficult to modify the syntax
rules of the Py3K translation tool to convert from the old to the new
syntax""" and leaving it at that doesn't give me any clue what the
fixer should do. If you're writing a PEP and you're unsure as to what
2to3 can do, I'm happy to work with you and help figure out what kind
of translation rules are possible/practical for your needs.
Thanks,
Collin Winter
More information about the Python-3000
mailing list