[Python-ideas] Assignments in list/generator expressions

Jim Jewett jimjjewett at gmail.com
Tue Apr 12 19:16:59 CEST 2011

On 4/12/11, Terry Reedy <tjreedy at udel.edu> wrote:
> On 4/12/2011 4:31 AM, Nick Coghlan wrote:

>> 1. You wish to avoid polluting the current namespace with working
>> variables and helper functions (most relevant for module and class
>> level code, but may also be relevant for functions in some closure
>> related contexts)

> I am puzzled why namespace sanitation fans are so allergic to the
> namespace cleanup statement == 'del'.

You have to do it explicitly, which calls attention to it precisely
when you were ready to forget it.

In other words, it has all the disadvantages that pre-decorator
function wrapping did, and (if it were really needed) all the
disadvantages of manual memory management, and the additional concern
that -- because it is not idiomatic -- readers will expect that
variable name (or at least that namespace) to be particularly


More information about the Python-ideas mailing list