On Oct 31, 1:31 ¨Βν¬ ΠιΓαπιταιξ Όπιτ®γαπιτ®®®ΐηναιμ®γονΎ χςοτεΊ > 2008/10/31 Yuh-Ruey Chen <maian... / gmail.com>: > > > x = 10 > > > def foo > > how to access x from here? > > end > > > class Klass > > how to access x from here? > > ¨Βεζ βα> > how to access x from here? > > ¨Βξδ > > end > > > And no, I don't want to have to use global variables - that would just > > be pollution and would be incredibly unwieldy in large projects. > > What is the difference between your "local" variable x, which should > be accessible from everywhere, and a global variable? > > Regards, > Pit The difference that the local variable doesn't have to be defined in global scope. Only child scopes should have access to that local variable. def foo a = 10 def bar # should somehow be able to access a end bar end foo # here, we should not be able to access foo's a, but if there is another a in scope, we can access that Or to put it in Python: a = 20 def foo(): a = 10 def bar(): print a # prints 10 bar() foo() print a # prints 20