[Python-Dev] A new way to configure logging
Vinay Sajip
vinay_sajip at yahoo.co.uk
Wed Oct 7 17:49:56 CEST 2009
Olemis Lang <olemis <at> gmail.com> writes:
> This kind of problems is similar to the one mentioned in another
> thread about modifying config options after executing commands. In
> that case I mentioned that the same dict-like interface also holds for
> WinReg and so on ...
>
> So thinking big (yes ! I have a big head ! ) I think that the best
> approach in this case is to build an adaptation (simple) layer on top
> of ConfigParser, JSON, WinReg, PyCode, YAML, ... and build specific
> extensions for these formats . Perhaps the proper interfaces are
> already there (e.g. `dict`, `shelve` ) and I'm just blind and looking
> somewhere else ;o)
Sorry, you've lost me :-)
> > import copy
> > self.config = copy.deepcopy(config)
>
> Why ?
So I'm free to mutate self.config as I see fit.
> extension is cool ... what's the point about adding the new method
> instead of using `DictConfigurator` directly ?
When you say "the new method", if you mean "configure" - the pattern is so that
a subclass can override __init__ and do additional setup before configure() is
called.
Regards,
Vinay Sajip
More information about the Python-Dev
mailing list