[Python-ideas] Unpacking a dict
brenbarn at brenbarn.net
Wed May 25 14:55:10 EDT 2016
On 2016-05-25 11:42, Steven D'Aprano wrote:
> If the target on the left has a colon, it is an identifier followed by
> key. The identifier can be any valid reference, including dots and 
> subscripts. The key must be a string:
> which performs:
> identifier = mapping['key']
Why does the key have to be a string? I agree that the common case is
where you want to assign to a local variable with the same name as the
string key, but if you do allow specifying how keys map to assignment
targets, it seems like you might as well allow non-string keys.
"Do not follow where the path may lead. Go, instead, where there is no
path, and leave a trail."
More information about the Python-ideas