From: Lawrence D'Oliveiro on
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
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
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