Most Pythonic way to store (small) configuration

Ben Finney ben+python at
Mon Aug 3 03:16:09 CEST 2015

Cecil Westerhof <Cecil at> writes:

> On Sunday  2 Aug 2015 13:54 CEST, Ben Finney wrote:
> > 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.
> Well, I would use nested data. (A file will have extra fields besides
> the name.)

In that case, your needs are more complex than “store some simple
configuration”. You need a human-editable format (so, not JSON and not
XML) which handles structured data well, and is widely implemented.

For nested configuration data, you would be better served by YAML
<URL:>, and the PyYAML library
<URL:> is the one to use.

 \                                        學而不思則罔,思而不學則殆。 |
  `\        (To study and not think is a waste. To think and not study |
_o__)             is dangerous.) —孔夫子 Confucius (551 BCE – 479 BCE) |
Ben Finney

More information about the Python-list mailing list