Recommended "new" way for config files

P

Peter

Hi
There seems to be several strategies to enhance the old ini-style config
files with real python code, for example:

1) the documentation tool sphinx uses a python file conf.py that is
exefile(d) , but execfile is suppressed in Python 3
2) there is a module cfgparse on sourceforge that supports a hybrid style
3) modern tools like ipython seems to favor a new style based on python
code config files but also support a hybrid style mixing .ini files and
python code files.
4) I could use __import__ to import modules based on some command line
options


Is there a strategy that should be prefered for new projects ?

thanks
peter
 
N

Nicola Larosa (tekNico)

Peter said:
There seems to be several strategies to enhance the old ini-style config
files with real python code
[...]
Is there a strategy that should be prefered for new projects ?

5) Use ConfigObj <http://www.voidspace.org.uk/python/configobj.html>,
by Michael Foord and yours truly. It uses an extension of the ini-
style config format. Sorry for the multiple brackets, my fault. :)

--
Nicola Larosa - http://www.tekNico.net/

Ci sono paesi in cui un gesto violento se compiuto da un uomo su una
don-
na è punito più severamente: si chiama uguaglianza sostanziale,
compensa
la disuguaglianza di partenza. [...] Se vince la cultura dei
"vincenti"
le donne perderanno. Non fanno la guerra, in genere. È una perdita di
tempo: hanno altro da fare. - Concita De Gregorio, Novembre 2009
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,113
Latest member
Vinay KumarNevatia
Top