[Python-ideas] Unpacking a dict

Zachary Ware zachary.ware+pyideas at gmail.com
Fri May 27 11:44:46 EDT 2016


On Fri, May 27, 2016 at 10:41 AM, Michael Selik <michael.selik at gmail.com> wrote:
> On Fri, May 27, 2016 at 11:38 AM Zachary Ware
> <zachary.ware+pyideas at gmail.com> wrote:
>> On Fri, May 27, 2016 at 10:32 AM, Michael Selik <michael.selik at gmail.com>
>> wrote:
>> >> - solves dict unpacking
>> >
>> > Would it solve nested dict unpacking?
>>
>> How do you mean?  Replacing `some_name =
>> some_dict['some_key']['some_name']` with `from some_dict['some_key']
>> import some_name`?
>
> No, more like
>     py> {'name': name, 'location': {0: row, 1: col} = mapping
>     py> name, row, col
>     ('Mike', 3, 5)

That reads as gibberish to me (and also as SyntaxError, you're missing
a '}'), so probably not :)

-- 
Zach


More information about the Python-ideas mailing list