Prev: The real problem with Python 3 - no business case forconversion (was "I strongly dislike Python 3")
Next: The real problem with Python 3 - no business case for conversion (was "I strongly dislike Python 3")
From: Lawrence D'Oliveiro on 23 Jul 2010 20:08 In message <7j8w5tylmw.fsf(a)rapun.sel.cam.ac.uk>, Matthew Vernon wrote: > Is there a more idiomatic way of loading in a configuration file > that's python code ... Is it really a good idea to have a configuration language that's Turing- complete?
From: Ben Finney on 23 Jul 2010 20:53 Lawrence D'Oliveiro <ldo(a)geek-central.gen.new_zealand> writes: > In message <7j8w5tylmw.fsf(a)rapun.sel.cam.ac.uk>, Matthew Vernon wrote: > > > Is there a more idiomatic way of loading in a configuration file > > that's python code ... > > Is it really a good idea to have a configuration language that's Turing- > complete? I think not. Configuration files should be read as data; they should be declarative only, not executable languages. That way, a different program can read and parse them without having to be a parser for an entire programming language. As illustration of this point, I present the chronic headaches of the Python 'setup.py' file. It tries to be both setup program *and* configuration file, with the consequence that in the general case it's impossible to get configuration information without executing the setup program. Recent work (lots of it!) by the Distutils team has gone into separating the concerns so that the configuration data is all in a non-executable data file; that work is ongoing, and it's been a hard lesson to learn. -- \ “If [a technology company] has confidence in their future | `\ ability to innovate, the importance they place on protecting | _o__) their past innovations really should decline.” —Gary Barnett | Ben Finney
From: Jean-Michel Pichavant on 29 Jul 2010 05:35
Ben Finney wrote: > Lawrence D'Oliveiro <ldo(a)geek-central.gen.new_zealand> writes: > > >> In message <7j8w5tylmw.fsf(a)rapun.sel.cam.ac.uk>, Matthew Vernon wrote: >> >> >>> Is there a more idiomatic way of loading in a configuration file >>> that's python code ... >>> >> Is it really a good idea to have a configuration language that's Turing- >> complete? >> > > I think not. Configuration files should be read as data; they should be > declarative only, not executable languages. That way, a different > program can read and parse them without having to be a parser for an > entire programming language. > For local non distributed applications, configuration files written in python are just fine. JM |