Most Pythonic way to store (small) configuration
marko at pacujo.net
Wed Aug 5 23:47:37 CEST 2015
Tim Chase <python.list at tim.thechases.com>:
> There's a certain simplicity to simply having key/value pairs
> separated by an "=" and then letting the application do whatever it
> needs/wants with those key/value strings.
That trap has lured in a lot of wildlife.
What to do with lists?
Is whitespace significant?
Case in point, systemd configuration files:
It specifies all kinds of application-do-whatever-it-needs syntax:
* backslash escapes
* double quotes and single quotes
* line continuations
* percent specifiers
* dollar substitution with or without braces
* double-dollar escape
* together with undocumented quirks (for example, how do you specify a
command whose pathname contains whitespace?)
All of which makes it all but impossible to algorithmically escape a
literal command into the ExecStart= entry.
When you start with something that's too simple, you end up with layers
of ever-increasing complexity but never attain the expressive power of
JSON, S-expressions and the like (I don't have the stomach to mention
More information about the Python-list