Creating a local variable scope.
johan.gronqvist at gmail.com
Fri Sep 18 15:55:47 CEST 2009
Thanks for all replies.
First, two general comments, and then my conclusions:
I did not intend to ask for new features, but my interest was in writing
readable code that works in python 2.5, although I may upgrade to 2.6 soon.
Also, what I gave was intended as a minimal example, and not a complete
Summarizing the answers, it seems that I will try to follow three
1) In general, try to restructure the code into smaller modules and
2) When using many local variables bindings to create one larger object,
define an inner function that hides those bindings.
3) If I define a few values intended to be used very locally, delete
those after use.
More information about the Python-list