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


Groups > comp.lang.python > #95044

Re: Most Pythonic way to store (small) configuration

Path csiph.com!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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; 'encoded': 0.05; 'dependency': 0.07; 'escape': 0.07; 'subject:skip:c 10': 0.07; 'trailing': 0.07; 'cc:addr:python-list': 0.09; 'files"': 0.09; 'files:': 0.09; 'marking': 0.09; 'thu,': 0.15; 'configuring': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simple.': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'config': 0.18; 'string,': 0.18; ';-)': 0.18; 'shell': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'init': 0.22; 'simpler': 0.22; 'strip': 0.22; 'am,': 0.23; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; "i've": 0.25; '(which': 0.26; 'error': 0.27; 'compare': 0.27; 'define': 0.27; 'handling': 0.27; 'possibility': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'chase': 0.29; 'idea,': 0.29; 'quoting': 0.29; 'spaces': 0.29; 'whitespace': 0.29; "i'm": 0.30; 'that.': 0.30; 'too.': 0.30; 'especially': 0.32; 'subject:) ': 0.32; 'usually': 0.33; 'point,': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'files,': 0.35; 'unicode': 0.35; 'something': 0.35; 'sometimes': 0.35; 'but': 0.36; 'project': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'wanted': 0.37; 'itself': 0.38; 'someone': 0.38; 'files': 0.38; 'mean': 0.38; 'end': 0.39; 'means': 0.39; 'goes': 0.39; 'sure': 0.39; 'where': 0.40; 'space': 0.40; 'some': 0.40; 'ever': 0.60; 'your': 0.60; 'leading': 0.61; 'avoid': 0.61; 'more': 0.63; 'equals': 0.66; "they're": 0.66; 'chrisa': 0.84; 'complex.': 0.84; 'complexity': 0.84; 'touching': 0.84; 'to:none': 0.91
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=jbj3xgG21s6Z5GngnptHMqB2o33ylNQifKhn/28kx9s=; b=nnM/Ef9DzMCQ2CP1myKDFyRu+4pzWYcyQyXKOqsB9m3PmFazHk5shwn4NLfXPMbba9 aGaGrs9/iYNnsLqQGBFl6hffiB/dNMR+ndRTtQG4FoDzpagN6FnGApqHOsfRzJbKGPz7 qj2Fo4VA9cutgkHI0cyJX8G0rN6+vZdPzmpeKE+dRCGZT/SX7Bw5LweXyJqb53OH9h5H mPyhzNQRE/h3r/X6ydreMOjpOYFv9OHx6fh7djIBEDjqiludsuUXH18dJKt4oPTMflzp 6Ez361Ps7036+lhvaNaxLAtcMZ3OIQdx415zdwz1YaZpTqwkFyWQx5GVdKo8sb5QpEj+ cy4Q==
MIME-Version 1.0
X-Received by 10.50.143.37 with SMTP id sb5mr340912igb.13.1438819656001; Wed, 05 Aug 2015 17:07:36 -0700 (PDT)
In-Reply-To <20150805184354.596616fd@bigbox.christie.dr>
References <87k2teq9tb.fsf@Equus.decebal.nl> <mailman.1240.1438781266.3674.python-list@python.org> <36333f24-3bda-4534-b22f-20c99e8d791c@googlegroups.com> <mailman.1247.1438808479.3674.python-list@python.org> <87fv3xpfuu.fsf@elektro.pacujo.net> <20150805184354.596616fd@bigbox.christie.dr>
Date Thu, 6 Aug 2015 10:07:35 +1000
Subject Re: Most Pythonic way to store (small) configuration
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.20+
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.1251.1438819658.3674.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1438819658 news.xs4all.nl 2857 [2001:888:2000:d::a6]:33510
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95044

Show key headers only | View raw


On Thu, Aug 6, 2015 at 9:43 AM, Tim Chase <python.list@tim.thechases.com> wrote:
> Significant whitespace?  Not usually simple (just stuck touching a
> project where someone committed with tons of trailing whitespaces.
> grumble), so strip 'em off as if they're an error condition.  I've
> never had a config-file where I wanted leading/trailing whitespace as
> significant.

If you're configuring a prompt, sometimes you need to be able to
include a space at the end of it. Since trailing whitespace on a line
in the file itself is a bad idea, you need some way of marking it.
That might mean quoting the string, or having a Unicode or byte escape
like \x20 that means space, or something like that. If you define that
spaces around your equals sign are insignificant, you need the same
sort of system to cope with the possibility of actual leading
whitespace, too.

>> Case in point, systemd configuration files:
>
> The antithesis of "simplicity" ;-)

Ehh... I reckon they're pretty simple. They're somewhat more powerful
than Upstart config files, and pay some complexity cost for that; but
they're a lot simpler than sysvinit "config files" (which are actually
shell scripts), especially with all the dependency handling cruft that
goes into encoded comments. Frankly, I do my best to avoid ever
touching those. I'm not sure what else to compare them against (never
used any init system other than the three just mentioned), so I don't
see systemd files as being particularly complex.

ChrisA

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


Thread

Most Pythonic way to store (small) configuration Cecil Westerhof <Cecil@decebal.nl> - 2015-08-02 12:11 +0200
  Re: Most Pythonic way to store (small) configuration Chris Angelico <rosuav@gmail.com> - 2015-08-02 20:49 +1000
  Re: Most Pythonic way to store (small) configuration Ben Finney <ben+python@benfinney.id.au> - 2015-08-02 21:54 +1000
    Re: Most Pythonic way to store (small) configuration Cecil Westerhof <Cecil@decebal.nl> - 2015-08-02 18:51 +0200
      Re: Most Pythonic way to store (small) configuration Lele Gaifax <lele@metapensiero.it> - 2015-08-02 22:02 +0200
      Re: Most Pythonic way to store (small) configuration Cameron Simpson <cs@zip.com.au> - 2015-08-03 08:49 +1000
      Re: Most Pythonic way to store (small) configuration Ben Finney <ben+python@benfinney.id.au> - 2015-08-03 11:16 +1000
  Re: Most Pythonic way to store (small) configuration Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-02 16:12 +0100
  Re: Most Pythonic way to store (small) configuration Tim Chase <python.list@tim.thechases.com> - 2015-08-02 16:11 -0500
    Re: Most Pythonic way to store (small) configuration Dan Sommers <dan@tombstonezero.net> - 2015-08-03 04:02 +0000
      Re: Most Pythonic way to store (small) configuration Steven D'Aprano <steve@pearwood.info> - 2015-08-03 23:38 +1000
        Re: Most Pythonic way to store (small) configuration Chris Angelico <rosuav@gmail.com> - 2015-08-03 23:46 +1000
        Re: Most Pythonic way to store (small) configuration Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-03 15:37 +0100
  Re: Most Pythonic way to store (small) configuration marco.nawijn@colosso.nl - 2015-08-04 07:53 -0700
    Re: Most Pythonic way to store (small) configuration Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-08-04 19:06 +0200
      Re: Most Pythonic way to store (small) configuration marco.nawijn@colosso.nl - 2015-08-04 11:37 -0700
    Re: Most Pythonic way to store (small) configuration Ben Finney <ben+python@benfinney.id.au> - 2015-08-05 05:59 +1000
      Re: Most Pythonic way to store (small) configuration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-08-05 18:32 +1000
        Re: Most Pythonic way to store (small) configuration Chris Angelico <rosuav@gmail.com> - 2015-08-05 20:01 +1000
    Re: Most Pythonic way to store (small) configuration Michael Torrie <torriem@gmail.com> - 2015-08-04 19:32 -0600
      Re: Most Pythonic way to store (small) configuration Grant Edwards <invalid@invalid.invalid> - 2015-08-05 14:00 +0000
    Re: Most Pythonic way to store (small) configuration random832@fastmail.us - 2015-08-04 22:44 -0400
    Re: Most Pythonic way to store (small) configuration Michael Torrie <torriem@gmail.com> - 2015-08-04 22:48 -0600
      Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-04 21:55 -0700
        Re: Most Pythonic way to store (small) configuration Lele Gaifax <lele@metapensiero.it> - 2015-08-05 08:54 +0200
  Re: Most Pythonic way to store (small) configuration Tim Chase <python.list@tim.thechases.com> - 2015-08-05 08:18 -0500
    Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-05 06:37 -0700
      Re: Most Pythonic way to store (small) configuration Tim Chase <python.list@tim.thechases.com> - 2015-08-05 15:55 -0500
        Re: Most Pythonic way to store (small) configuration Marko Rauhamaa <marko@pacujo.net> - 2015-08-06 00:47 +0300
          Re: Most Pythonic way to store (small) configuration Tim Chase <python.list@tim.thechases.com> - 2015-08-05 18:43 -0500
          Re: Most Pythonic way to store (small) configuration Chris Angelico <rosuav@gmail.com> - 2015-08-06 10:07 +1000
            Re: Most Pythonic way to store (small) configuration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-08-06 17:33 +1000
              Re: Most Pythonic way to store (small) configuration Chris Angelico <rosuav@gmail.com> - 2015-08-06 17:51 +1000
        Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-05 18:01 -0700
          Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-05 18:06 -0700
  Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-05 06:46 -0700
    Re: Most Pythonic way to store (small) configuration Steven D'Aprano <steve@pearwood.info> - 2015-08-06 00:08 +1000
      Re: Most Pythonic way to store (small) configuration Rustom Mody <rustompmody@gmail.com> - 2015-08-05 07:25 -0700

csiph-web