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


Groups > comp.lang.python > #19645

configobj

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'suppose': 0.05; 'happily': 0.07; 'conf': 0.09; 'least)': 0.09; 'looked': 0.15; 'declaring': 0.16; 'key?': 0.16; 'things?': 0.16; 'val': 0.16; 'thanks,': 0.18; 'trying': 0.20; "doesn't": 0.22; 'work,': 0.26; "i'm": 0.27; 'example': 0.28; 'second': 0.29; 'allowed,': 0.30; 'list': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'instead': 0.33; 'to:addr:python-list': 0.33; 'there': 0.33; 'received:209.85.212': 0.34; 'file.': 0.34; 'declared': 0.34; 'question': 0.35; 'file': 0.35; '(to': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'couple': 0.38; 'option': 0.39; 'why': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'one,': 0.40; 'more': 0.61; 'granted': 0.68; 'andrea': 0.84; 'ps.': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=yww2plVLvsgZLERIgAQ+m71hUFkUQK36NOLLw3Irodw=; b=eRXwqNB3Luj4T7RoB1L3NBM36He6+XHUMO6U4SgIHUeewfPzFwD+Wv2v4mxYfnhxXU r1kl5wBQpInKNk3XqE5m8fOssqXhMSf1d3R6V8+JU5a38dxdquCdmVXpr0QNdx0OhRm9 +ctzZE3Ztc5jpAKPDn69LbHBNNIA53MUAZFGU=
Date Tue, 31 Jan 2012 16:06:16 +0000
From Andrea Crotti <andrea.crotti.0@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1
MIME-Version 1.0
To python-list@python.org
Subject configobj
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5250.1328025981.27778.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328025981 news.xs4all.nl 6906 [2001:888:2000:d::a6]:59372
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19645

Show key headers only | View raw


I have a couple of questions about configobj, which I'm happily trying
to use for this project.

The first question is, how do I make a very long list of things?
Suppose I have declared in a spec file.

val = string_list

now I would like to do
val = one,
       two,
       three

but that's not allowed, and also
val = one, \
       two, \
       three

doesn't work, is there a way to avoid to write everything on one line?

The second question is, how do I avoid declaring twice the default
value?

For example supposing I have this spec:
skip_pesky_pyc_paths = string_list

I was giving for granted that (pseudocode ahead)
conf = ConfigObj(spec=myspec)
conf['skip_pesky_pyc_paths'] == []

but it's not the case, if it's not declared in the conf file it just
doesn't find the key?
Is there a magic option to make it create the key when they are not
declared from the spec?

Thanks,
Andrea

PS. and why by the way ConfigObj is not in the standard lib, instead of 
ConfigParser,
     which looked less complete and more cumbersome (to me at least)

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


Thread

configobj Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-31 16:06 +0000

csiph-web