<div dir="ltr">On Wednesday, 15 April 2015 12:44:59 UTC+1, Chris Angelico wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Based on the subject line, I have to first apologize that I may come
<br>off as mean and scary, with a sneer that curdles dairy. But here goes.
<br>Feel free to hate me for saying this. :)
<br>
<br></blockquote><div><br></div><div>I have no problem with "harsh but fair".</div><div> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">There is a fundamental difficulty with the unification of the
<br>disparate, in that you have to start coping with all sorts of
<br>differences and try to make sense of them *in code*. When, for
<br>instance, you want to unify config handling, what you're saying is
<br>either that every config handler has to devolve to the lowest common
<br>denominator, or else that your unified config handler has to become
<br>the least common multiple.</blockquote><div><br></div><div>The stdlib is full of modules which don't attempt everything but instead attempt to do a useful subset and everyone seems to be happy they're included.</div><div><br></div><div>Why not configuration file handling?</div><div><br></div><div>I assume we're writing Python code and that eventually all config data needs to end up in memory that Python can access.</div><div><br></div><div>Pulling numbers out of my posterior, lets say 80% of projects only need nothing more than a text file with a set of sections with name/value pairs under them. That can be parsed into a dict.</div><div>And 5% want to use Python code. That when it gets exec'ed a dict comes out the other end</div><div>And 5% want to use a database. We can produce an adapter (say sqlite) that spits out a dict or they can.</div><div>And 5% want to use an etcd store.</div><div>That leaves 5% that want to do something funky. They're on their own<br></div><div><br></div><div>There aren't that many configuration storage systems in the world.</div><div><br></div><div>Then you define the order which sources (command line / env var / global config etc.) are used and merge them into a complete configuration</div><div><br></div><div>Why not 'bless' some code which simplifies the 95%</div><div><br></div><div>There's a distribution on PyPi called 'layeredconfig' which does much of what I think could be done. A few Python projects I've encountered seem to follow a similar pattern.</div><div><br></div><div>I'm not sure that I see the demons you appear to see in config file handling. Perhaps you could give a real world example</div><div> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">The latter may seem tempting ("you can use
<br>this module to do ANYTHING!"), but you quickly fall foul of the
<br>Inner-Platform Effect.
<br>
<br><a href="http://thedailywtf.com/articles/The_Inner-Platform_Effect" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fthedailywtf.com%2Farticles%2FThe_Inner-Platform_Effect\46sa\75D\46sntz\0751\46usg\75AFQjCNEL4zOr2FTtOve1Uu2UJkioL3yyMw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fthedailywtf.com%2Farticles%2FThe_Inner-Platform_Effect\46sa\75D\46sntz\0751\46usg\75AFQjCNEL4zOr2FTtOve1Uu2UJkioL3yyMw';return true;">http://thedailywtf.com/<wbr>articles/The_Inner-Platform_<wbr>Effect</a>
<br><a href="https://en.wikipedia.org/wiki/Inner-platform_effect" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInner-platform_effect\46sa\75D\46sntz\0751\46usg\75AFQjCNGhcvO9pf9luNBfA2mSn_16OxT7FQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInner-platform_effect\46sa\75D\46sntz\0751\46usg\75AFQjCNGhcvO9pf9luNBfA2mSn_16OxT7FQ';return true;">https://en.wikipedia.org/wiki/<wbr>Inner-platform_effect</a>
<br>
<br></blockquote><div><br></div><div>That's not a term I've encountered before. But perhaps it's part of my problem but I looked at the Wikipedia page and I'm not sure it makes a case that the effect is bad.</div><div><br></div><div>For example the first is about Firefox's FTP. I use Sublime Text and some of the packages you can install do similar things but I'm not sure I would say they were wrong to wrap git for example.</div><div><br></div><div>Then it talks about and RDBMS and the<font face="arial, sans-serif" size="2"> <a href="https://en.wikipedia.org/wiki/Entity-attribute-value_model" title="Entity-attribute-value model" class="mw-redirect" style="color: rgb(11, 0, 128); line-height: 17.9200000762939px; background-image: none; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">entity-attribute-value model</a> but RDF uses a similar structure and is used with RDBMSs so it can't be all bad.</font></div><div><font face="arial, sans-serif" size="2"><br></font></div><div><font face="arial, sans-serif" size="2">Then XML is mentioned. But I'll not touch that subject.</font></div><div><font face="arial, sans-serif" size="2"><br></font></div><div><font face="arial, sans-serif" size="2">Then ChromeOS. Which people seem to like. So it's not affected it too much.</font></div><div><font face="arial, sans-serif" size="2"><br></font></div><div><font face="arial, sans-serif" size="2">The only downside seems to be "</font><font face="arial, sans-serif" size="2"><span style="color: rgb(37, 37, 37); line-height: 17.9200000762939px;">they tend to be slower and if poorly coded, less reliable as well.</span><sup class="noprint Inline-Template Template-Fact" style="line-height: 1; color: rgb(37, 37, 37); white-space: nowrap;">[<i><a href="https://en.wikipedia.org/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed" style="color: rgb(11, 0, 128); background: none;"><span title="This claim needs references to reliable sources. (December 2014)">citation needed</span></a></i>]". </sup></font>But you could say that about any code.</div><div><br></div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">If you want something to be truly customizable, the best way is to
<br>make it Turing-complete and then let people write code. CPython is an
<br>ultimately-customizable application, and we call its config files
<br>"Python scripts". There's not a lot of point adding another
<br>infinitely-customizable layer on top of that, just for something as
<br>simple as configuration files. Better to allow code to be code.
<br>
<br>Several of your proposals have merit, but they should be disentangled
<br>from the ones which will just drag them down.
<br>
<br>ChrisA
<br></blockquote><div><br></div><div>Simon </div></div>