[Python-3000] exclusion feature for 2to3?
g.brandl at gmx.net
Mon Jul 16 13:23:29 CEST 2007
Guido van Rossum schrieb:
> On 7/15/07, Georg Brandl <g.brandl at gmx.net> wrote:
>> In order to have a codebase run in 2.x and 3.x, via automated translated by
>> 2to3, there should be some "exclusion feature" for single lines that tells
>> the refactorer not to touch those lines.
>> For example, if you have some object that still has an iteritems() method and
>> keeps it, it'll have to stay the same during translation.
>> Same goes, e.g., for methods named next(), has_key() etc.
>> Most obvious would be a special comment, something like
>> for x in curiousobject.iteritems(): # 2to3:keep
>> Does that make sense?
> Absolutely. (Were you in the audience of my keynote at EuroPython? I
> believe I briefly mentioned the need for such a feature there. :-)
No, I ran the new documentation toolset through 2to3; and e.g. docutils
nodes have a has_key() that does something else than __contains__().
Good to know it's planned!
More information about the Python-3000