[DB-SIG] Dictionaries Pass By Reference?
Horst Herb
subscriptions@gnumed.net
Fri, 01 Nov 2002 15:05:47 +1100
Tom Rabaut wrote:
> I'm under the understanding that dictionaries are pass by reference in python, but it doesn't seem to be working for me. I'm declaring the dictionary in main then passing it to a function member of a module where it is populated, but when I attempted to use it, it is still empty in the main program.
Off topic, but here you go:
IDLE 0.8 -- press F1 for help
>>> def filldic(dic):
dic[1] = 1
>>> def mainfunc():
dic = {}
filldic(dic)
print dic[1]
>>> mainfunc()
1
Works. Check your code.
Horst