From a language design standpoint I think that having non-constant keys in the unpack map makes a lot of sense. As far as implementation, I would imagine that using non-constant expressions for the keys should be fine. If you look at the proposed implementation, the UNPACK_MAP instruction just wants the stack to have N values on the stack, it shouldn't matter how they got there.

On Wed, Aug 12, 2015 at 11:41 AM, <random832@fastmail.us> wrote:
On Wed, Aug 12, 2015, at 09:57, Scott Sanderson wrote:
> def do_stuff_from_json(json_dict):
>     # Assigns variables in the **values** of the lefthand side by doing
> lookups
>     # of the corresponding keys in the result of the righthand side
> expression.
>     {'foo': foo, 'bar': bar} = json.loads(json_dict)

How about:

key = 'foo'
key2 = 'bar'
{key: value, key2: value2, **rest} = json.loads(json_dict)
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/