New assignmens ...

Antoon Pardon antoon.pardon at vub.be
Mon Oct 25 16:16:47 EDT 2021


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()]:
    ...



More information about the Python-list mailing list