[Python-ideas] Assignments in list/generator expressions
Nick Coghlan
ncoghlan at gmail.com
Mon Apr 11 04:33:50 CEST 2011
On Mon, Apr 11, 2011 at 8:48 AM, Guido van Rossum <guido at python.org> wrote:
> On Sun, Apr 10, 2011 at 12:28 PM, Arnaud Delobelle <arnodel at gmail.com> wrote:
>> OK. It's clear I don't know enough about the compiling process to be able to understand all the problems. The f.__name__ issue doesn't seem insurmountable, but I can't see how to get around the locals()["x"] issue in a sane manner (I see what you mean about cursing the locals() function!). BTW, I think there is a typo in the example above: shouldn't
>>
>> y = locals("x"), ...
>>
>> be
>>
>> y = locals()["x"], ...
>
> FWIW, I don't mind if an implementation of this (or anything new,
> really) doesn't work well with locals().
While supporting locals() correctly is a bit of a pain, I find "Does
read access to locals() still work?" to be a useful proxy for "Will
proposing this feature have authors of Python debugging tools massing
outside my front door with pitchforks and torches?" :)
I don't think it's a trade-off that has to be made in the specific
case of PEP 3150 - the copy-in/copy-out idea should be viable and
reasonably intuitive given Python's existing scoping rules.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list