Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78493
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-09-30 09:39 -0700 |
| References | <54hqfb-nan.ln1@chris.zbmc.eu> <36d7ddca-29f4-403c-a64d-611e187afc3a@googlegroups.com> <bgtqfb-ndq.ln1@chris.zbmc.eu> |
| Message-ID | <a140612a-a30d-43eb-93a3-bc08b76b5721@googlegroups.com> (permalink) |
| Subject | Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? |
| From | Rustom Mody <rustompmody@gmail.com> |
On Tuesday, September 30, 2014 8:48:15 PM UTC+5:30, c...@isbd.net wrote: > Rustom Mody wrote: > > On Tuesday, September 30, 2014 5:18:31 PM UTC+5:30, Chris wrote: > > > I would actually > > > quite like to keep the configuration data separate from the code as it > > > would simplify using the data at the 'home' end of things as I'd just > > > need to copy the configuration file across. This was why the database > > > approach appealed at first as all I need to do is copy the database > > > and everything is in there. > > Of course > > > Are there any better ways of doing this? E.g. some sort of standard > > > configuration file format that Python knows about? > > Umm this is getting to be a FAQ... > > Maybe it should go up somewhere? > > Yes there are dozens: > > - ini > > - csv > > - json > > - yml > > - xml > > - pickle > > - And any DBMS of your choice > > I guess Ive forgotten as many as Ive listed!! > Yes, I know, I've found most of those. I'm really asking for help in > choosing which to use. I think I can reject some quite quickly:- > xml - horrible, nasty to edit, etc. I don't like XML! :-) Heh! Youve proved yourself a pythonista! > ini - doesn't work so well with lists/dictionaries (though possible) > csv - rather difficult to edit Have you tried with comma=tab? > yml - front runner if I go for configuration files Yeah my favorite as well > json - one of the most likely possibilities, but prefer yml Seems to be most popular nowadays -- maybe related to being almost yaml and in the standard lib > pickle - not user editable as I understand it Well not in any reasonably pleasant way! > What I'm really asking for is how to choose between:- <snipped> > python - just keep config in the modules/classes, not easy to use > at 'both ends' (home and remote), otherwise quite simple Can work at a trivial level. As soon as things get a bit larger data and code mixed up is a recipe for mess up.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Keepin constants, configuration values, etc. in Python - dedicated module or what? cl@isbd.net - 2014-09-30 12:35 +0100
Re:Keepin constants, configuration values, etc. in Python - dedicated module or what? Dave Angel <davea@davea.name> - 2014-09-30 09:14 -0400
Re: Re:Keepin constants, configuration values, etc. in Python - dedicated module or what? cl@isbd.net - 2014-09-30 15:55 +0100
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Dave Angel <d@davea.name> - 2014-10-02 14:50 -0400
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Rustom Mody <rustompmody@gmail.com> - 2014-09-30 06:15 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? cl@isbd.net - 2014-09-30 16:06 +0100
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? jkn <jkn_gg@nicorp.f9.co.uk> - 2014-09-30 08:59 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Rustom Mody <rustompmody@gmail.com> - 2014-09-30 09:39 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Chris Angelico <rosuav@gmail.com> - 2014-10-01 02:51 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Rustom Mody <rustompmody@gmail.com> - 2014-09-30 10:01 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Chris Angelico <rosuav@gmail.com> - 2014-10-01 03:15 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Rustom Mody <rustompmody@gmail.com> - 2014-09-30 10:31 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Chris Angelico <rosuav@gmail.com> - 2014-10-01 03:46 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-02 00:49 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Chris Angelico <rosuav@gmail.com> - 2014-10-02 00:55 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? cl@isbd.net - 2014-09-30 18:30 +0100
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Chris Angelico <rosuav@gmail.com> - 2014-10-01 03:49 +1000
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? Rustom Mody <rustompmody@gmail.com> - 2014-10-16 18:24 -0700
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? "Neil D. Cerutti" <neilc@norwich.edu> - 2014-09-30 12:16 -0400
Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? cl@isbd.net - 2014-09-30 18:50 +0100
csiph-web