This should be a simple question...
andrew at acooke.org
Fri Mar 6 22:04:24 CET 2009
Steven D'Aprano wrote:
> Steve Holden wrote:
>> If x and b are meant to be global than bite the bullet and *make* them
> Well, there's global, and there's global.
> There's global to a few functions in a module, there's global to
> in a module, and global to an entire application. They're not necessarily
> the same thing.
this is probably drifting a bit far from the original question, but i have
used function scope to hide information "global" to a few functions. the
idea is to use a factory function that generates them all.
a = 12
b = 34
if a == x:
return x * b
(ifamultb, somethinelse) = factory()
that's off the top of my head. you might need to work around python's
stupid scoping rules with hidden params:
def ifamultb(x, a=a):
More information about the Python-list