When do default parameters get their values set?
bSneddon
bsneddon at 1
Tue Dec 9 11:32:01 EST 2014
I ran into an issue setting variables from a GUI module that imports a back end
module. My approach was wrong obviously but what is the best way to set values
in a back end module.
#module name beTest.py
cfg = { 'def' : 'blue'}
def printDef(argT = cfg['def']):
print argT
#module name feTest
import beTest
beTest.cfg['def'] = "no red"
beTest.printDef()
This prints blue. I suppose because I am changing a local copy of cfg
dictionary. What is the write approach here?
Thanks
Bill
--- SoupGate-Win32 v1.05
* Origin: <SpaceSST.BBS.Fidonet<>NNTP.gateway. at .piz.noip.me> (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet <> Fidonet Gateway
More information about the Python-list
mailing list