[ python-Bugs-1520864 ] unpack list of singleton tuples not unpacking

SourceForge.net noreply at sourceforge.net
Wed Jul 12 01:21:13 CEST 2006


Bugs item #1520864, was opened at 2006-07-11 17:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1520864&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Anthony Tuininga (atuining)
Assigned to: Nobody/Anonymous (nobody)
Summary: unpack list of singleton tuples not unpacking

Initial Comment:
The following code works differently in Python 2.5 than
Python 2.4:

x = [(1,), (2,), (3,)]
for y, in x:
    print y

In Python 2.4, this code produces the following:
1
2
3

In Python 2.5, this code produces the following:
(1,)
(2,)
(3,)

Interestingly enough the following code:

x = (1,)
y, = x
print y

produces the output
1

in both Python 2.4 and Python 2.5. I'm thinking this is
not intentional. :-)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1520864&group_id=5470


More information about the Python-bugs-list mailing list