<p dir="ltr">I am against this. Try something else please. Keep import for modules.</p>
<p dir="ltr">--Guido (mobile)</p>
<div class="gmail_quote">On May 27, 2016 11:08 AM, "Nikolaus Rath" <<a href="mailto:Nikolaus@rath.org">Nikolaus@rath.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On May 27 2016, Ethan Furman <<a href="mailto:ethan-gcWI5d7PMXnvaiG9KC9N7Q@public.gmane.org">ethan-gcWI5d7PMXnvaiG9KC9N7Q@public.gmane.org</a>> wrote:<br>
> On 05/27/2016 08:09 AM, Nikolaus Rath wrote:<br>
>> On May 26 2016, Paul Moore wrote:<br>
>>> On 26 May 2016 at 18:55, Ethan Furman wrote:<br>
><br>
>>>> With the simple syntax that I could live with, a real example could be:<br>
>>>><br>
>>>>    {active_id, active_ids, active_model} = context<br>
>>>><br>
>>>> or<br>
>>>><br>
>>>>    {partner_id, product_id, ship_to, product_ids} = values<br>
>>><br>
>>> The behaviour of using the names of the variables from the LHS to<br>
>>> introspect the value on the RHS is, to me, extremely magical and<br>
>>> unlike anything I've seen in any other language. I don't think it sits<br>
>>> well in Python, even though it is certainly a very readable idiom for<br>
>>> the sort of unpacking we're talking about here.<br>
>><br>
>> Very true. But as someone else already said (I can't find the email<br>
>> right now), we have a different construct that everyone is familiar with<br>
>> and that's easily adapted for this situation:<br>
>><br>
>> from dict context import active_id, active_ids, active_model<br>
>><br>
>> or more general:<br>
>><br>
>> "from dict"  <expr> "import" <identifier list><br>
>><br>
>> Everyone knows that "from .. import .." modifies the local namespace. We<br>
>> just have to extend it to work not just on modules, but also on<br>
>> dictionaries.<br>
><br>
> -1<br>
><br>
> import works with modules.<br>
<br>
You don't think of it as "*import*ing something from another namespace<br>
into the local namespace"? That's the first thing that I associate with<br>
it.<br>
<br>
> Having it work with other things would<br>
> muddy the concept, plus make module/object naming conflicts an even<br>
> bigger hassle.<br>
<br>
You did see that I proposed "from dict <> import ..", instead of "from<br>
<> import ..", right? The latter would continue to work only for<br>
modules. The form would be new syntax and only work for dicts.<br>
<br>
<br>
Best,<br>
-Nikolaus<br>
<br>
--<br>
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F<br>
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F<br>
<br>
             »Time flies like an arrow, fruit flies like a Banana.«<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a></blockquote></div>