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 steven.daprano
Recipients ezio.melotti, martin.panter, mrabarnett, steven.daprano, umedoblock
Date 2017-04-17.01:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492391569.4.0.422129051388.issue30084@psf.upfronthosting.co.za>
In-reply-to
Content
> list expression pass starred expression, the other hand
> tuple expression cannot pass starred expression.

You are misinterpreting what you are seeing.

( ) is not a tuple expression (except for the special case of empty brackets, which makes an empty tuple). It's just grouping an expression. So (*x) is equivalent to just bare *x.

To make a tuple, you need a comma.

Apart from the empty tuple, the brackets are just for grouping. Put a comma after the starred expression and it will work:

py> t = 1, 2
py> t
(1, 2)
py> (*t,)
(1, 2)


The trailing comma is allowed in lists as well:

py> [*t,]
[1, 2]


I agree with Martin: there's no bug here, the behaviour is consistent with the way tuples and lists are normally created, and there's no need to make (*t) yet another special case.

If you really want to argue in favour of this change, I suggest you discuss it on the Python-Ideas mailing list and see if you can get community consensus for it. *If* you get agreement that this is a good idea, then you can re-open this.
History
Date User Action Args
2017-04-17 01:12:49steven.dapranosetrecipients: + steven.daprano, ezio.melotti, mrabarnett, umedoblock, martin.panter
2017-04-17 01:12:49steven.dapranosetmessageid: <1492391569.4.0.422129051388.issue30084@psf.upfronthosting.co.za>
2017-04-17 01:12:49steven.dapranolinkissue30084 messages
2017-04-17 01:12:48steven.dapranocreate