Global Objects...

Chaz Ginger cginboston at hotmail.com
Wed Aug 16 06:07:51 EDT 2006


KraftDiner wrote:
> I have a question..
> 
> myGlobalDictionary = dictionary()
> 
> 
> class someClass:
>    def __init__(self):
>       self.x = 0;
>    def getValue(self, v)
>       myGlobalDictionary.getVal(v)
> 
> 
> myGlobalDictionary doesn't seem to be visible to my someClass methods.
> Why?  What should I do?
> 
Is it an oversight that you forgot the ':' on the getValue definition?
You also forgot to do the return. I say the code should look like:

def getValue(self,v) :
	return myGlobalDictionary[v]

I am also confused as to what getVal() does.

Chaz



More information about the Python-list mailing list