[Python-ideas] How assignment should work with generators?

Chris Angelico rosuav at gmail.com
Mon Nov 27 11:03:47 EST 2017

On Tue, Nov 28, 2017 at 1:46 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Tue, Nov 28, 2017 at 01:01:01AM +1100, Chris Angelico wrote:
>> And the status quo is noisy and has duplicated
>> information (you have to match the ", 2" to the number of assignment
>> targets).
> Er, not really. How about:
> a, b = islice(iterable, 3, 10, 4)
> A somewhat unusual case, to be sure, but still legal.

Well, sure. But the situation that's equivalent to the proposal here
is simply islice(iterable, 2). There's no proposal to have something
that assigns the way you're slicing there, and there's certainly no
proposal to abolish islice.


More information about the Python-ideas mailing list