[Python-ideas] Assignments in list/generator expressions

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Apr 12 19:03:30 CEST 2011


On Tue, Apr 12, 2011 at 12:35 PM, Terry Reedy <tjreedy at udel.edu> wrote:
..
> I am puzzled why namespace sanitation fans are so allergic to the namespace
> cleanup statement == 'del'.

Because using cleanup may unexpectedly clobber the variables you want
to keep.  When using

for var in [..]:
  ..
del var

idiom, I tend to maintain some naming convention for what var can be
so that it does not conflict with other global variables.  Naming
conventions are usually considered suboptimal work-arounds for
languages with poor namespace support.



More information about the Python-ideas mailing list