Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75951
| From | Fabien <fabien.maussion@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: The "right" way to use config files |
| Date | 2014-08-09 19:17 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <ls5l38$ita$1@speranza.aioe.org> (permalink) |
| References | <ls51q0$4ea$1@speranza.aioe.org> <mailman.12792.1407586666.18130.python-list@python.org> <ls54fh$aoe$1@speranza.aioe.org> <mailman.12794.1407601013.18130.python-list@python.org> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The "right" way to use config files Fabien <fabien.maussion@gmail.com> - 2014-08-09 13:48 +0200
Re: The "right" way to use config files Ben Finney <ben+python@benfinney.id.au> - 2014-08-09 22:17 +1000
Re: The "right" way to use config files Fabien <fabien.maussion@gmail.com> - 2014-08-09 14:33 +0200
Re: The "right" way to use config files Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-08-09 12:16 -0400
Re: The "right" way to use config files Fabien <fabien.maussion@gmail.com> - 2014-08-09 19:17 +0200
Re: The "right" way to use config files Tim Chase <python.list@tim.thechases.com> - 2014-08-09 12:08 -0500
Re: The "right" way to use config files Terry Reedy <tjreedy@udel.edu> - 2014-08-09 13:29 -0400
Re: The "right" way to use config files Fabien <fabien.maussion@gmail.com> - 2014-08-09 20:14 +0200
Re: The "right" way to use config files Terry Reedy <tjreedy@udel.edu> - 2014-08-09 18:30 -0400
Re: The "right" way to use config files Fabien <fabien.maussion@gmail.com> - 2014-08-10 10:33 +0200
csiph-web