homepage

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 drj
Recipients drj
Date 2014年02月23日.11:11:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393153907.74.0.496388533035.issue20742@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following code:
for z in zip([1]):pass
2to3 does not convert the zip in this code to list(zip(...)); it does not change this code at all.
That can be an (obscure) bug because the zip in Python 2 has different semantics from the zip in Python 3.
The output of this program
from __future__ import print_function
S = []
def l(c):
 for i in [0,1]:
 S.append(c)
 yield i
 S.append(c.upper())
la = l('a')
lb = l('b')
for a,b in zip(la, lb):
 S.append("#")
print(''.join(S))
is different in Python 2 and Python 3 (when converted with 2to3, which doesn't change the program).
In Python 2 the output is:
ababA##
In Python 3 the output is:
ab#ab#A
Obviously this example is somewhat contrived, but I have a non-contrived example involving decoding PNG images (if anyone is interested).
History
Date User Action Args
2014年02月23日 11:11:47drjsetrecipients: + drj
2014年02月23日 11:11:47drjsetmessageid: <1393153907.74.0.496388533035.issue20742@psf.upfronthosting.co.za>
2014年02月23日 11:11:47drjlinkissue20742 messages
2014年02月23日 11:11:46drjcreate

AltStyle によって変換されたページ (->オリジナル) /