New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unpack list of singleton tuples not unpacking #43651
Comments
The following code works differently in Python 2.5 than x = [(1,), (2,), (3,)]
for y, in x:
print y In Python 2.4, this code produces the following: In Python 2.5, this code produces the following: Interestingly enough the following code: x = (1,)
y, = x
print y produces the output in both Python 2.4 and Python 2.5. I'm thinking this is |
Logged In: YES Ouch. This is bad. The disassembly shows that the compiler |
Logged In: YES Awww come on, can't we change the language just to make your Thanks a lot for catching this! Committed revision 50597. |
Logged In: YES I have the impression that the bug has only been partially Python 2.5c1 (r25c1:51305, Sep 4 2006, 10:15:09)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> l = [(1,), (2,)]
>>> print [x for x, in l]
[(1,), (2,)] Same example in Python 2.4.3: Python 2.4.3 (#1, Jul 25 2006, 11:53:03)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> l = [(1,), (2,)]
>>> print [x for x, in l]
[1, 2] |
Logged In: YES You're right. Attached patch fixes this. |
Logged In: YES Thanks for spotting this. Let us know if you find any more Well, I'm glad Georg and I came up with the same basic patch Committed revision 51729. (2.6) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: