Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21623
| Date | 2012-03-14 13:13 -0500 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: Is there a ConfigParser which keeps comments |
| References | <jjpql7$b70$1@dough.gmane.org> <jjqj6q$kre$1@dough.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.648.1331751843.3037.python-list@python.org> (permalink) |
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
Re: Is there a ConfigParser which keeps comments Tim Chase <python.list@tim.thechases.com> - 2012-03-14 13:13 -0500
csiph-web