Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82156
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-12-08 15:35 -0800 |
| References | <8c10ecec-c057-4580-9711-94c0a5151646@googlegroups.com> |
| Message-ID | <1d8cda49-8949-44a2-997f-5ae3fc6a5013@googlegroups.com> (permalink) |
| Subject | Re: When do default parameters get their values set? |
| From | bSneddon <w.g.sneddon@gmail.com> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
When do default parameters get their values set? bSneddon <w.g.sneddon@gmail.com> - 2014-12-08 14:10 -0800 Re: When do default parameters get their values set? Chris Angelico <rosuav@gmail.com> - 2014-12-09 09:28 +1100 Re: When do default parameters get their values set? Chris Kaynor <ckaynor@zindagigames.com> - 2014-12-08 14:28 -0800 Re: When do default parameters get their values set? Dave Angel <davea@davea.name> - 2014-12-08 17:30 -0500 Re: When do default parameters get their values set? Tim Chase <python.list@tim.thechases.com> - 2014-12-08 16:26 -0600 Re: When do default parameters get their values set? bSneddon <w.g.sneddon@gmail.com> - 2014-12-08 15:35 -0800 Re: When do default parameters get their values set? Terry Reedy <tjreedy@udel.edu> - 2014-12-08 20:37 -0500
csiph-web