I hate gmail, always forgetting to set the right recipient...
---------- Forwarded message ----------
From: Martin Marcher <
[email protected]>
Date: 29.10.2007 10:11
Subject: Re: sharing vars with different functions
To: "(e-mail address removed)" <
[email protected]>
2007/10/29 said:
Im tryin to call a var thats sitting in a function, example:
i guess im not graspng the whole global or local var topic..
does this help?
.... somevar = ["a", "b"]
.... def __init__(self):
.... self.another_var = ["c", "d"]
....
Foo.somevar ['a', 'b']
f = Foo()
f.somevar ['a', 'b']
f.another_var ['c', 'd']
Foo.somevar = "New Value"
f.somevar 'New Value'
Foo.another_var
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Foo' has no attribute 'another_var'