This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hfuru
Recipients benjamin.peterson, bobbyi, eric.araujo, hfuru, loewis, vstinner
Date 2010-11-15.14:51:05
SpamBayes Score 2.1543878e-13
Marked as misclassified No
Message-id <hbf.20101115z9dv@bombur.uio.no>
In-reply-to <4CDDD907.4030906@v.loewis.de>
Content
Martin v. Löwis writes:
> As this code is in a Python 2.x block: why does this change cause
> problems to you? You are supposed to run the 2to3 result in Python 3,
> and this conversion result will run correctly in Python 3.

As I've explained, and as the if-statement and the associated comment
expresses, that piece of code is intended to work with both Python 2
and 3.

2to3 turns it into code which would break on Python 2.  I've explained
why I'd run 2to3 on such code, and thus why it'd be convenient if I
could ask 2to3 to leave such code alone.  So I requested this feature.
I don't know exactly how I'm "supposed" to use 2to3.  If you are its
inventor, you do.  Otherwise it may also be supposed to suit other
workflows than yours.

> Ok, I can propose two different spellings of this without any
> macro processor: (...)

Both your examples fit my request perfectly.  Pieces of code which I
presume are correct for both Python 2 and 3, and 2to3 break them for
both Python versions.  With "my" feature, the code would keep working
with both.

However, it is true that there are other cases where I'd like to shut
up 2to3 but where my suggested solution would not be convenient to
use.  I am after all requesting a mere convenience feature, and aimed
for something I hoped would be a simple matter to implement.  I never
imagined that merely explaining it would grow into such a discussion.

Bobby, thanks for the sa2to3 reference.  Doesn't quite do what I
wanted, but looks useful and might also be a good starting point for
what I did ask for.  Hopefully I won't need to understand too much
2to3 code first...
History
Date User Action Args
2010-11-15 14:51:07hfurusetrecipients: + hfuru, loewis, vstinner, benjamin.peterson, eric.araujo, bobbyi
2010-11-15 14:51:05hfurulinkissue10070 messages
2010-11-15 14:51:05hfurucreate