[Python-ideas] Unpacking a dict

Guido van Rossum guido at python.org
Sun May 29 19:49:07 EDT 2016

On Sun, May 29, 2016 at 1:05 PM, Nikolaus Rath <Nikolaus at rath.org> wrote:
> On May 29 2016, Guido van Rossum <guido-+ZN9ApsXKcEdnm+yROfE0A at public.gmane.org> wrote:
>> Any idea using import syntax or even syntax similar to import is dead.
> Does that mean the whole idea is dead? Because as I see it, there are
> only two ways this could possibly be implemented:
> 1. As a statement similar to import, which you declared dead.

Any use of the word 'import' (even in combination with other words) is
verboten. Anything *starting* with 'from' also sounds like a bad idea.

> 2. As an assignment, which you declared dead IIRC primarily because the
>    RHS should not be "peeking" into the LHS.


> Or am I interpreting "similar to import" too broadly? Is a statement
> using other words still on the table?
>  d = {"foo": 42}
>  <something> d <something> 42 # or the other way around
>  assert foo == 42

This I don't understand -- why would the '42' appear in the extraction
syntax? I guess you meant "foo"?

Maybe we can riff on

  extract foo from d

? Though honestly that looks like it would be extracting d.foo, no d['foo'].

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list