Creating a local variable scope.
gagsl-py2 at yahoo.com.ar
Fri Sep 18 22:31:24 CEST 2009
En Fri, 18 Sep 2009 10:55:47 -0300, Johan Grönqvist
<johan.gronqvist at gmail.com> escribió:
> Summarizing the answers, it seems that I will try to follow three
> 1) In general, try to restructure the code into smaller modules and
> smaller functions.
That's a good thing - "manageable" modules and functions.
> 2) When using many local variables bindings to create one larger object,
> define an inner function that hides those bindings.
I'd say, not to *hide* those bindings, but because the code fragment
deserves logically to become a function.
> 3) If I define a few values intended to be used very locally, delete
> those after use.
Why bother? Unless they're big objects and you want to ensure they get
deleted as soon as possible.
More information about the Python-list