➜

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.

作者 drj
收信人 drj
日期 2014-02-23.11:11:46
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1393153907.74.0.496388533035.issue20742@psf.upfronthosting.co.za>
In-reply-to
内容
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).
历史
日期 用户 动作 参数
2014-02-23 11:11:47drj修改recipients: + drj
2014-02-23 11:11:47drj修改messageid: <1393153907.74.0.496388533035.issue20742@psf.upfronthosting.co.za>
2014-02-23 11:11:47drj链接issue20742 messages
2014-02-23 11:11:46drj创建