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


Groups > comp.lang.python > #78494

Re: Keepin constants, configuration values, etc. in Python - dedicated module or what?

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'true,': 0.05; 'subject:Python': 0.06; 'expressions': 0.07; 'mess': 0.09; 'mixed': 0.09; 'subject:module': 0.09; 'subject:skip:c 10': 0.09; 'whatever.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'constants.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'recipe': 0.16; 'subject:etc.': 0.16; 'subject:values': 0.16; 'value"': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'module': 0.19; 'file,': 0.19; 'normally': 0.19; 'examples': 0.20; 'code,': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'config': 0.24; 'helpful': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'second': 0.26; '(for': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'relative': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'file:': 0.31; 'subject:what': 0.31; 'trivial': 0.31; 'stuff': 0.32; 'option': 0.32; 'quite': 0.32; 'up.': 0.33; 'level.': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'seconds': 0.37; 'represent': 0.38; 'sometimes': 0.38; 'previous': 0.38; 'little': 0.38; 'easy': 0.60; 'free': 0.61; 'break': 0.61; 'simple': 0.61; 'first': 0.61; 'soon': 0.63; 'more': 0.64; 'subject:. ': 0.67; 'calculations': 0.84; 'difference.': 0.84; 'technically': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FBt7U4rYztU1CwVkNxpecJjUZP6KILr/PCa2mLMEIoM=; b=fQwNY3FOjvkS4jfeh/Jj0CP751LtbwDc3uSbMdUhbykT+wwsLiXpf4AJ6uISRrS7iZ l7xeJfN+KLJLAVlpBkUTBLX87/S+pHnGHC+jbSLxfQWnkdL2+DyFnClVLuA3Qm5Posx0 1AHk8IrsWSxDWjFtWKlIewVuTPczwlHpGXCCnqmYhLF3drwMac4PnuvtSii0YVkOsSsg H0DVyJGuVf7QDvXESfTt/heQXIrFNl52yGjHa01ek4PJR/yx/huf2jYTNN7ozWHF7Y6o 55dYuU9gZoW6i9gJ96Aj8S/BcUYczHU+MxlD/lGJ3rcq6EYAYA4t2pyRAzTew3Nan79w 166g==
MIME-Version 1.0
X-Received by 10.112.61.225 with SMTP id t1mr4851688lbr.104.1412095887805; Tue, 30 Sep 2014 09:51:27 -0700 (PDT)
In-Reply-To <a140612a-a30d-43eb-93a3-bc08b76b5721@googlegroups.com>
References <54hqfb-nan.ln1@chris.zbmc.eu> <36d7ddca-29f4-403c-a64d-611e187afc3a@googlegroups.com> <bgtqfb-ndq.ln1@chris.zbmc.eu> <a140612a-a30d-43eb-93a3-bc08b76b5721@googlegroups.com>
Date Wed, 1 Oct 2014 02:51:27 +1000
Subject Re: Keepin constants, configuration values, etc. in Python - dedicated module or what?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14489.1412095890.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412095890 news.xs4all.nl 2879 [2001:888:2000:d::a6]:34956
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78494

Show key headers only | View raw


On Wed, Oct 1, 2014 at 2:39 AM, Rustom Mody <rustompmody@gmail.com> wrote:
>>     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.

True, but it's certainly possible to break out the config data into an
importable module that conceptually just provides constants.
Technically it's code, yes, but it'll normally be code that looks like
your standard "name = value" config file:

# docs for first option
# more docs
# examples
# etcetera
first_option =123

# docs for second option
second_option = 234


Is that Python code, or is it a sectionless INI file, or what? There's
no difference. And you get expressions for free - simple stuff like
"7*24*60*60" to represent the number of seconds in a week (for people
who aren't intimately familiar with 604800), or calculations relative
to previous data, or whatever. Sometimes it's helpful to have just a
little code in your data.

ChrisA

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


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