shortcut for large amount of global var declarations?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Tue May 11 01:46:56 EDT 2010
In message <mailman.2771.1273327690.23598.python-list at python.org>, Alex Hall
wrote:
> ... I have about fifteen vars in a function which have to be
> global.
Why not make them class variables, e.g.
class my_namespace :
var1 = ...
var2 = ...
#end my_namespace
def my_function(...) :
... can directly read/assign my_namespace.var1 etc here ...
#end my_function
Also has the benefit of minimizing pollution of the global namespace.
More information about the Python-list
mailing list