On Feb 22, 9:20 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Fri, 22 Feb 2008 19:11:01 -0800 (PST), icarus <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > But how do I get around it? How do I update and access a variable > > anytime I want? Any easy-to-follow examples? Thanks in advance. >
<snip> > > Oh... and you pass the instance, as a parameter, in/out of all other > invoked methods that might need it. Thereby there is never a global > reference to it. > > -- For instance: ############### class global: def __init__(self, x): self.x = x return myGlobal = global(1.0) def subA(top): print top.x subA(myGlobal) ############### For me, the reason to avoid global variables is that it's much easier down the road when I want to make my program ran in an multi-process, or multi-threaded situation. -- http://mail.python.org/mailman/listinfo/python-list