Hi --
I'm trying to migrate a bunch of hard-coded configuration information to an
external INI file with ConfigObj. I am using this in a Python package that
has a bunch of individual files, typically called from the command line, as
well as library or utility scripts that are called from the command-line
files. I'd like any of these to have access to a shared, parsed
configuration object, but I'm not actually sure how to implement that
elegantly. I would imagine this is common for ConfigObj users that just want
config info loaded once per invocation. Is there a pythonic way of handling
singleton patterns like this? Should I stick the ConfigObj loader in a
separate config.py file that is loaded from each other script?
Thanks!
Ramon
P.S. I'm not actually sure I need a singleton in the OO sense: the
configuration info doesn't need to be wrapped in a class instance, but just
needs a simple way to access the loaded configuration object.
|