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 wim.glenn
Recipients Windson Yang, georg.brandl, gvanrossum, serhiy.storchaka, wim.glenn
Date 2019-05-13.21:33:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557783188.89.0.244266526837.issue36761@roundup.psfhosted.org>
In-reply-to
Content
Serhiy,

`a, *L[::2] = "abc"` as an alternative is interesting, thanks.  The other example `L[:], *rest = 'abcdef'` is less interesting because L[:] can be arbitrary size.

When noticing this, I had tried to consume a generator into every other position in a list by using:

    L[::2], *extra = g

Though there are obvious workarounds (e.g. using `itertools.islice`), it surprised me that CPython did not "do what I mean" out of the box. 

However, since creating the issue, it was brought to my attention that trying to handle this assignment may result in potential ambiguity, for example:

    L = [0, 1, 2]
    L[::2], *rest = "ab", "c", "d"

There is no obvious choice for result here. So, perhaps this issue should just be closed.
History
Date User Action Args
2019-05-13 21:33:08wim.glennsetrecipients: + wim.glenn, gvanrossum, georg.brandl, serhiy.storchaka, Windson Yang
2019-05-13 21:33:08wim.glennsetmessageid: <1557783188.89.0.244266526837.issue36761@roundup.psfhosted.org>
2019-05-13 21:33:08wim.glennlinkissue36761 messages
2019-05-13 21:33:08wim.glenncreate