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...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
problem with variable and function
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password