Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40600

Re: Config & ConfigParser

References <61520ad1-9e3c-4eec-b1d9-8a9d8fc7bf0c@googlegroups.com> <5136b87c$0$30001$c3e8da3$5496439d@news.astraweb.com>
Date 2013-03-06 15:05 +1100
Subject Re: Config & ConfigParser
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2922.1362542728.2939.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Config & ConfigParser Chuck <galois271@gmail.com> - 2013-03-05 12:09 -0800
  Re: Config & ConfigParser Tim Chase <python.list@tim.thechases.com> - 2013-03-05 15:17 -0600
    Re: Config & ConfigParser Chuck <galois271@gmail.com> - 2013-03-05 15:58 -0800
      Re: Config & ConfigParser Tim Chase <python.list@tim.thechases.com> - 2013-03-05 18:15 -0600
        Re: Config & ConfigParser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-06 04:04 +0000
  Re: Config & ConfigParser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-06 03:31 +0000
    Re: Config & ConfigParser Chris Angelico <rosuav@gmail.com> - 2013-03-06 15:05 +1100
      Re: Config & ConfigParser Neil Cerutti <neilc@norwich.edu> - 2013-03-07 16:18 +0000
    Re: Config & ConfigParser Chuck <galois271@gmail.com> - 2013-03-05 20:07 -0800
      Re: Config & ConfigParser Chris Angelico <rosuav@gmail.com> - 2013-03-06 15:19 +1100
        Re: Config & ConfigParser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-06 04:54 +0000
          Re: Config & ConfigParser Chris Angelico <rosuav@gmail.com> - 2013-03-06 17:09 +1100

csiph-web