Why shouldn't you put config options in py files

2008-12-04 Thread HT
A colleague of mine is arguing that since it is easy to write config like: FOO = {'bar': ('a': 'b'), 'abc': ('z': 'x')} in config.py and just import it to get FOO, but difficult to achieve the same using an ini file and ConfigParser, and since Python files are just text, we should just write the

Re: Why shouldn't you put config options in py files

2008-12-04 Thread Chris Rebert
On Thu, Dec 4, 2008 at 11:35 AM, HT [EMAIL PROTECTED] wrote: A colleague of mine is arguing that since it is easy to write config like: FOO = {'bar': ('a': 'b'), 'abc': ('z': 'x')} I'll assume you meant ('a', 'b') as colons in parens don't make sense. in config.py and just import it to get

Re: Why shouldn't you put config options in py files

2008-12-04 Thread malkarouri
On 4 Dec, 19:35, HT [EMAIL PROTECTED] wrote: A colleague of mine is arguing that since it is easy to write config like: FOO = {'bar': ('a': 'b'), 'abc': ('z': 'x')} in config.py and just import it to get FOO, but difficult to achieve the same using an ini file and ConfigParser, and since

Re: Why shouldn't you put config options in py files

2008-12-04 Thread HT
Chris Rebert wrote: On Thu, Dec 4, 2008 at 11:35 AM, HT [EMAIL PROTECTED] wrote: FOO = {'bar': ('a': 'b'), 'abc': ('z': 'x')} I'll assume you meant ('a', 'b') as colons in parens don't make sense. Yes, sorry. Well, it is pretty weird to be allowed to put arbitrary code in a mere config

Re: Why shouldn't you put config options in py files

2008-12-04 Thread rdmurray
On Thu, 4 Dec 2008 at 11:35, HT wrote: I can think of lots of arguments why this is a bad idea, but I don't seem to be able to think of a really convincing one. I think it depends on the problem domain. As someone else said, there are issues with being able to inject arbitrary code via the

Re: Why shouldn't you put config options in py files

2008-12-04 Thread Bruno Desthuilliers
HT a écrit : A colleague of mine is arguing that since it is easy to write config like: FOO = {'bar': ('a': 'b'), 'abc': ('z': 'x')} in config.py and just import it to get FOO, but difficult to achieve the same using an ini file and ConfigParser, and since Python files are just text, we should

Re: Why shouldn't you put config options in py files

2008-12-04 Thread James Matthews
I am going to have to agree with your colleague. I use Django a lot and you are editing config.py and urls.py which are all python code. On Thu, Dec 4, 2008 at 10:30 PM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: HT a écrit : A colleague of mine is arguing that since it is easy to write