On 25.05.2016 15:11, Michael Selik
wrote:
I hope to keep discussion in this thread focused on
the most basic form of dict unpacking, but we could extended mapping unpacking similarly to
how PEP 3132 extended iterable unpacking. Just
brainstorming...
Another idea (borrowed from Erlang):
>>> mapping = {"a": 1, "b":
2, "c": 3}
>>> {"a": x, "b": y, "c": 3} = mapping
>>> x,y
(1,2)
>>> mapping = {"a": 1, "b":
2, "c": 3}
>>> {"a": x, "b": y, "c": 2} = mapping
Traceback:
ValueError: key 'c' does not
match to 2
Best,
Sven