Config & ConfigParser

Chris Angelico rosuav at gmail.com
Tue Mar 5 23:05:18 EST 2013


On Wed, Mar 6, 2013 at 2:31 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> 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"

>From there, it's easy to decide whether to make them into command-line
parameters, a parseable config file, an importable Python script
("from config import *" is an easy and simple way to make that one),
or whatever.

ChrisA



More information about the Python-list mailing list