When do default parameters get their values set?
bSneddon
w.g.sneddon at gmail.com
Mon Dec 8 18:35:19 EST 2014
Thanks to all. I now understand what is happening. Originally wrote a script be executed from command line. No want to use Gui to change defaults. Will refactor to fix where necessary.
On Monday, December 8, 2014 5:10:58 PM UTC-5, bSneddon wrote:
> 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
More information about the Python-list
mailing list