Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75950

Re: The "right" way to use config files

Date 2014-08-09 12:08 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: The "right" way to use config files
References <ls51q0$4ea$1@speranza.aioe.org>
Newsgroups comp.lang.python
Message-ID <mailman.12796.1407604196.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2014-08-09 13:48, Fabien wrote:
> So I had the idea to define a super-object which parses the config
> file and input data and is given as a single parameter to the
> processing functions, and the functions take the information they
> need from it. This is tempting because there is no need for
> refactoring when I decide to change something in the config, but I
> am afraid that the program may become unmaintainable by someone
> else than myself. Another possibility would be at least to give all
> the functions access to the configfile.
> 
> To get to the point: is it good practice to give all elements of a 
> program access to the configfile and if yes, how is it done
> "properly"?

Though I don't like how it looks/feels to pass around the config in
just about any function-call that needs it, I've found that doing so
allows me to test more readily.  The alternative (putting it in a
global or some module) usually means that it's harder for me to test
in isolation.

-tkc


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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