The "right" way to use config files
Fabien
fabien.maussion at gmail.com
Sat Aug 9 13:17:30 EDT 2014
Hi,
On 09.08.2014 18:16, Dennis Lee Bieber wrote:
> Better, in my view, is to have the import module set up default values
> for everything, AND have a function at the bottom of the form
>
> def initialize(fid=None):
> if fid:
> # parse file "fid" replacing the module level items
> # this may require making a them all globals since
> # assignments inside this function would be locals
>
> And then your main program
>
> import myconfig
> ...
> myconfig.initialize(sys.argv[1])
Yes ok I think got it. Thanks! I like the idea and will implement it,
this will avoid the useless superobject and allow to have to configfile
available to anyone.
Fabien
More information about the Python-list
mailing list