[Python-3000] exclusion feature for 2to3?
Alexandre Vassalotti
alexandre at peadrop.com
Wed Jul 18 23:43:54 CEST 2007
On 7/15/07, Georg Brandl <g.brandl at gmx.net> wrote:
> Most obvious would be a special comment, something like
>
> for x in curiousobject.iteritems(): # 2to3:keep
> foo(x)
>
> Does that make sense?
It would be a good idea to define a convention for these special
comments. For example, we could define something similar to C's
pragma:
#pragma <feature> <option> ...
or perhaps,
#: <feature> <option> ...
So, your example would become:
for x in curiousobject.iteritems(): #pragma 2to3 keep
foo(x)
I expect other tools, like pdb.py and trace.py could follow this
convention as well. For example:
def buggy_func(): #pragma pdb break
pass
if debug: #pragma trace ignore
pass
The motivation for making a such convention, is to make it easy for
programmers to identify comments that are in fact control lines.
-- Alexandre
More information about the Python-3000
mailing list