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 martin.panter
Recipients ezio.melotti, martin.panter, mrabarnett, umedoblock
Date 2017-04-17.00:01:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492387271.82.0.104071890693.issue30084@psf.upfronthosting.co.za>
In-reply-to
Content
This doesn’t seem like a bug to me. At least it is consistent with the rule for making a tuple when there are commas versus returning the direct expression when there are no commas:

>>> x = (1); type(x)
<class 'int'>
>>> x = (1,); type(x)
<class 'tuple'>

I don’t think it is worth changing the syntax again just to pack a single starred expression into a tuple without a comma. If you really want to do that, it would be clearer to write

expression = (1, 2)
tuple_1 = (*expression,)  # Brackets and comma suggest a tuple
tuple_2 = tuple(expression)  # Tuple constructor even more obvious

Allowing tuple packing without a comma would add a new inconsistency with function calls. It would conflict with your list(*(1, 2)) case:

list(*(1, 2))  # Currently equivalent to list(1, 2)
list( (*(1, 2)) )  # Would be equivalent to list( (1, 2) )

The root problem IMO is that round brackets and commas have too many inconsistent special cases in Python (simple expressions vs tuples, tuples with zero, one or more items, function calls and signatures, generator expressions, unpacking assignments, etc). But it may be too hard to change any of this.
History
Date User Action Args
2017-04-17 00:01:12martin.pantersetrecipients: + martin.panter, ezio.melotti, mrabarnett, umedoblock
2017-04-17 00:01:11martin.pantersetmessageid: <1492387271.82.0.104071890693.issue30084@psf.upfronthosting.co.za>
2017-04-17 00:01:11martin.panterlinkissue30084 messages
2017-04-17 00:01:11martin.pantercreate