packing unpacking depends on order.

Chris Angelico rosuav at
Wed Sep 2 14:45:07 CEST 2015

On Wed, Sep 2, 2015 at 10:26 PM, Steven D'Aprano <steve at> wrote:
>> I think I understand how it gets these results
>> but I'm not really happy with them. I think python
>> should give the second result in both cases.
> Apart from breaking backwards compatibility, how would you implement such a
> thing? A simple left-to-right assignment rule is easy to implement and easy
> to understand even when the targets depend on each other.

I don't think this is really a question of implementation - it's a
design question of "should".

The current behaviour is reasonably sane. But if you're confused by
it, there's a simple solution: Don't reference the same "thing" more
than once on the LHS.


More information about the Python-list mailing list