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


Groups > comp.lang.python > #21623

Re: Is there a ConfigParser which keeps comments

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!xlned.com!feeder1.xlned.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '"if': 0.04; 'library,': 0.05; 'terry': 0.07; 'keys,': 0.09; 'storing': 0.09; 'subclass': 0.09; 'am,': 0.12; 'sections': 0.13; 'method.': 0.15; '-tkc': 0.16; 'altered': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'parser,': 0.16; 'preserved': 0.16; 'received:50': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'reedy': 0.16; 'sequence.': 0.16; 'subject:which': 0.16; 'cc:addr :python-list': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'file,': 0.21; 'header:In-Reply-To:1': 0.22; 'documented': 0.23; 'cc:2**0': 0.26; "i'm": 0.28; 'assuming': 0.29; 'cc:addr:python.org': 0.29; 'behaves': 0.30; 'comments.': 0.30; 'config': 0.30; 'minor': 0.32; 'changing': 0.32; 'header :User-Agent:1': 0.33; 'fair': 0.37; 'minimal': 0.37; 'but': 0.37; 'should': 0.38; 'that.': 0.39; 'back': 0.60; 'more': 0.61; 'anything,': 0.73; 'subject: ': 0.74; 'difference.': 0.84; 'gain.': 0.84; 'subject:there': 0.91
Date Wed, 14 Mar 2012 13:13:12 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16
MIME-Version 1.0
To Terry Reedy <tjreedy@udel.edu>
Subject Re: Is there a ConfigParser which keeps comments
References <jjpql7$b70$1@dough.gmane.org> <jjqj6q$kre$1@dough.gmane.org>
In-Reply-To <jjqj6q$kre$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
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.648.1331751843.3037.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1331751843 news.xs4all.nl 6987 [2001:888:2000:d::a6]:47844
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:21623

Show key headers only | View raw


On 03/14/12 12:06, Terry Reedy wrote:
> On 3/14/2012 6:07 AM, Gelonida N wrote:
>> Now I'm looking for a library, which behaves like config parser, but
>> with one minor difference.
>>
>> The write() mehtod should keep existing comments.
>
> Assuming that you have not overlooked anything, I would just subclass
> ConfigParser with an altered write method.

It would require a lot more than that.  It would entail changing 
the reading as well so that it preserved the comments as well as 
the order of sections & keys, and a way of storing those 
associated comments in sequence.  I looked into it a fair while 
back and it was a LOT more work than I cared to do for minimal 
gain.  I wimped out and just documented it with "If you use the 
ability to (re)write a configuration file, it will not keep any 
comments or ordering from any original sources."

-tkc

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


Thread

Re: Is there a  ConfigParser which keeps comments Tim Chase <python.list@tim.thechases.com> - 2012-03-14 13:13 -0500

csiph-web