[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

problem with variable and function

Alex Hall

3/14/2010 6:26:00 PM

Hi all,
I have a file with a dictionary and a function. The dictionary holds
the name of the function, and the function references the dictionary.
If I put the dictionary first, the function is happy but the
dictionary says the function is not defined. If I switch the two and
put the function first, the function says the dictionary does not
exist. Does anyone have an idea as to how I can make both of them
happy? Thanks!

Example:

myVar={
1:myFunc
}

def myFunc():
myOtherVar=myVar

would result in myVar saying myFunc does not exist. Reverse it, though:

def myFunc():
myOtherVar=myVar

myVar={
1:myFunc
}

and the function myFunc does not see the dictionary. I basically
cannot win either way, and I need a way to resolve this. If you are
curious, the dictionary holds function names and maps to a second
dictionary of keystrokes, allowing me to map a keystroke to call a
function. Thanks!

--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; http://www.facebook.c...