New assignmens ...

Chris Angelico rosuav at gmail.com
Mon Oct 25 17:03:41 EDT 2021


On Tue, Oct 26, 2021 at 7:18 AM Antoon Pardon <antoon.pardon at vub.be> wrote:
>
> Op 25/10/2021 om 20:39 schreef Chris Angelico:
> > On Tue, Oct 26, 2021 at 5:35 AM Antoon Pardon <antoon.pardon at vub.be> wrote:
> >> By putting limits on the walrus code, you are not reducing complexity, you are increasing it.
> >> You are increasing complexity because you can't just reuse the code that handles an ordinary
> >> assignment. You now need specific code to limit it's use.
> >>
> > What does this code do?
> >
> > while x, y := foo():
> >     ...
> >
> > Is it more complicated or less complicated when arbitrary assignment
> > targets are permitted?
>
> Well I would guess it would do something similar to
>
> while [x, y := foo()]:
>     ...
>

And does it unpack what foo returns?

Should it?

ChrisA


More information about the Python-list mailing list