On Tue, Mar 27, 2018 at 11:51 AM, Ivan Levkivskyi <levkivs...@gmail.com>
wrote:

> On 27 March 2018 at 19:43, Ethan Furman <et...@stoneleaf.us> wrote:
>
>> On 03/27/2018 11:12 AM, Ivan Levkivskyi wrote:
>>
>>> On 27 March 2018 at 18:19, Guido van Rossum wrote:
>>>
>>
>> Hm, so maybe we shouldn't touch lambda, but we can at least fix the scope
>>>> issues for comprehensions and genexprs.
>>>>
>>>
>>> Removing the implicit function scope in comprehensions is something I
>>> wanted for long time.
>>> It would not only "fix" the scoping, but will also fix the yield inside
>>> comprehensions.
>>>
>>
>> Can we do it without leaking names?
>>
>>
> If you mean this
>
> [i for i in range(5)]
>
> i  # NameError
>
> then yes, this is possible. Serhiy outlined the implementation few moths
> ago. The rough idea is to use automatic re-naming.
> The only problem with this is that if someone will step into debugger one
> will see a name like <comp>.0.i instead of i.
> But this can be solved in the debuggers.
>

Oh, sorry, I misread what you were talking about. You're proposing going
back to the Python 2 shared namespace. I'm not at all excited about that,
and I'm not convinced that adjusting debuggers to hide the name mangling is
effective -- it does nothing about other forms of introspection. Also
depending on how PEP 572 falls there may be assignments in there. Plus
there may be object lifetime consequences.

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to