On 10/11/10 03:36, Asun Friere wrote:
On Nov 10, 2:02 pm, Christian Heimes<li...@cheimes.de>  wrote:
Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes:

I'd like to know too. I work with java and jdom, but I'm doing
personal things in python, and plan to go full python in the next 2
years. Xml is my first option for configuration files and simple
storages.

Don't repeat the mistakes of others and use XML as a configuration
language. XML isn't meant to be edited by humans.

Yes but configuration files are not necessarily meant to be edited by
humans either!

Having said that, I'm actually old school and prefer "setting=value"
human editable config files which are easily read into a dict via some
code something like this:

<snippetysnip>


Me too when possible, TBH if I only needed strings and there was no pressing security issue I'd just do this...

config = {}
for line in (open("config.txt", 'r')):
    if len(line) > 0 and line[0] <> "#":
        param, value = line.rstrip().split("=",1)
        config[param] = value

There is a place for XML settings though, they're nice and portable and for some apps you probably don't want end users editing their configurations by hand in a text editor anyway, you would prefer them to use the nice consistency preserving config interface you have lovingly built for them. You have built them a nice GUI config interface haven't you ??? ;)

Roger
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to