Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: Config & ConfigParser Date: 7 Mar 2013 16:18:23 GMT Organization: Norwich University Lines: 33 Message-ID: References: <61520ad1-9e3c-4eec-b1d9-8a9d8fc7bf0c@googlegroups.com> <5136b87c$0$30001$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net ygBavR56HLlzABar9aO+lwi7rOTFR0JTxVvzN7Hhu63tFB/fobl2aiin6ZarUQk/uR Cancel-Lock: sha1:IO2KYw/mafffLtM8ehcpBbYE6GA= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: csiph.com comp.lang.python:40797 On 2013-03-06, Chris Angelico wrote: > On Wed, Mar 6, 2013 at 2:31 PM, Steven D'Aprano > wrote: >> What configuration settings does your podcast catcher software >> need? What makes you think it needs any? Don't over-engineer >> your application from the start. Begin with the simplest thing >> that works, and go from there. > > Agreed. The way I generally do these things is to simply gather the > config entries into a block of literal assignments at the top of the > program: > > host = "ftp" > port = 21 > proxy = "192.168.0.3:81" > user = "transfers" > password = "secret" I find it useful to stuff my config info in a class object; It is prettier than ALLCAPS, and also makes it simple to create and use new configurations without erasing or commenting out the old one. class Config: host = "ftp" port = 21 proxy = "192.168.0.3:81" user = "transfers" password = "secret" How much to engineer stuff is up to you. -- Neil Cerutti