[Baypiggies] configuration parser using python modules?

James Tatum jtatum at gmail.com
Fri Jul 13 20:53:39 CEST 2012


One of my pet peeves is using config files for things that really
should be in code. It's a peculiar habit which seems very prevalent in
areas like test frameworks where people often create massive XML
configuration schemas. Not only is XML a terrible config file format
(when the config file is meant to be written by humans), but using
most any static config file is abandoning the expressiveness possible
in code. Examples of configuration type things that are simple to do
in code include conditionals, loops, variable substitution, and being
able to encode any needed value or data type simply and easily.

On Fri, Jul 13, 2012 at 9:26 AM, Aleksandr Miroslav
<alexmiroslav at gmail.com> wrote:
> This may be obvious to people, but not to me, so I have to ask.
>
> Instead of using ConfigurationParser, why not have a configuration file
> be imported as a module, so this way, the variables could be part of the
> module's namespace.
>
> I know people have mentioned users running arbitrary code as a reason
> for why this should not be done, aside from this, is there any other
> reason? Is there a way to prevent users from running arbitrary code?
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies


More information about the Baypiggies mailing list