[Python-Dev] (no subject) (original) (raw)

Neil Girdhar mistersheik at gmail.com
Tue Feb 10 08:29:02 CET 2015


On Tue, Feb 10, 2015 at 2:20 AM, Victor Stinner <victor.stinner at gmail.com> wrote:

To be logic, I expect [(*item) for item in mylist] to simply return mylist.

If you want simply mylist as a list, that is [*mylist]

[*(item) for item in mylist] with mylist=[(1, 2), (3,)] could return [1, 2, 3], right

as just [*mylist], so "unpack" mylist.

[*mylist] remains equivalent list(mylist), just as it is now. In one case, you're unpacking the elements of the list, in the other you're unpacking the list itself.

Victor


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/mistersheik%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150210/d39353cd/attachment.html>



More information about the Python-Dev mailing list