Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Most Pythonic way to store (small) configuration Date: Thu, 06 Aug 2015 00:47:37 +0300 Organization: A noiseless patient Spider Lines: 44 Message-ID: <87fv3xpfuu.fsf@elektro.pacujo.net> References: <87k2teq9tb.fsf@Equus.decebal.nl> <36333f24-3bda-4534-b22f-20c99e8d791c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="24522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Jjfjmh+wKA/06gvUuMvUZ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:2An/sThBkghJMThuc0JZ/X0Llf4= sha1:0RlhW68VxEKWLHtXYWc3G+pvxOA= Xref: csiph.com comp.lang.python:95039 Tim Chase : > 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 XML). Marko