Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Re: Most Pythonic way to store (small) configuration Date: Sun, 02 Aug 2015 18:51:00 +0200 Organization: Decebal Computing Lines: 35 Message-ID: <87fv41r5vv.fsf@Equus.decebal.nl> References: <87k2teq9tb.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="6036"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LPeHyB2QcXKnyn9tMyflFt6Cjy1CaGPE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:cEdN6NWC7GhNOFsPgidxxh+fWqc= sha1:ZJLTXvMQdMKRv3aS9g3G0/eOGz8= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.python:94899 On Sunday 2 Aug 2015 13:54 CEST, Ben Finney wrote: > Cecil Westerhof writes: > >> Because of this I think a human readable file would be best. > > I agree with that criterion; in the absence of compelling reasons > otherwise, human-readable and -editable text is a good default. > >> Personally I do not find XML very readable. So a conf or json file >> looks the most promising to me. And I would have a slight >> preference for a json file. > > XML and JSON should both be considered data serialisation formats > only. > > JSON is human-readable to an extent, but it is quite brittle, and > there are no comments permitted in the syntax. > > So, both XML and JSON should be considered write-only, and produced > only for consumption by a computer; they are a poor choice for > presenting to a human. > > The “INI” format as handled by the Python ‘configparser’ module is > what I would recommend for a simple flat configuration file. It is > more intuitive to edit, and has a conventional commenting format. Well, I would use nested data. (A file will have extra fields besides the name.) That is why I was thinking about json. But I will look into it. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof