<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thank you all for your replies; they were most useful! I've never made a connection between xml and mass-suicide&nbsp; ---interesting. ;-) Yaml seems a good choice (I didn't llook at config parser yet). In my office, we use Python and R (among other tools) and therfore it seems best not to use some pure python config file format. I agree that the readability/editability (by humans) of a yaml file is a huge advantage. Today I experimented with the yaml library of R and it felt very intuitive. I expect this will be the same for Python (not in the last place because Python is such a *beautiful*, clear language ;-)<br><br>Cheers!!<br>
Albert-Jan<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>--- On <b>Tue, 7/27/10, Mac Ryan <i>&lt;quasipedia@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Mac Ryan &lt;quasipedia@gmail.com&gt;<br>Subject: Re: [Tutor] xml question<br>To: tutor@python.org<br>Date: Tuesday, July 27, 2010, 11:46 AM<br><br><div class="plainMail">On Mon, 2010-07-26 at 12:09 -0700, Albert-Jan Roskam wrote:<br>&gt; I am making a data processing program that will use a configuration<br>&gt; file. The file should contain information about: (1) source files<br>&gt; used, (2) (intermediate) output files, (3) used parameters/estimation<br>&gt; methods (4) manual data edits + datetime stamp + user name . I'd like<br>&gt; to store this config file in xml. However, I've never created<br>&gt; something like this before. Is this a suitable format, and, if so,<br>&gt; what
 would the elementtree look like? Should I just use 'config'&nbsp; or<br>&gt; something similar as root, and the information elements 1 through 3 as<br>&gt; child elements? And should the manual edits be stored as an element<br>&gt; 'edit' with various attributes (the edit itself, the time stamp,<br>&gt; etc.)?<br><br>I am with Steven on the fact that XML might not necessarily be the best<br>choice, unless you plan to use the configuration file with other<br>third-party programs, in which case the fact that XML has built-in<br>parsing libs for nearly all languages makes life of fellow developer<br>easier.<br><br>For the next project of mines, I am planning to use YAML (YAML Ain't a<br>Markup Language). I stumbled upon this format while toying around with<br>the google app engine, that uses it for storing your application<br>configuration data. IMO, YAML has the following prominent advantages:<br>&nbsp;&nbsp;&nbsp;1) It is easy to read and edit by humans
 [think "markdown"]<br>&nbsp;&nbsp;&nbsp;2) It has solid parsing libraries for Python<br>&nbsp;&nbsp;&nbsp;3) It is far less verbose than XML<br>&nbsp;&nbsp;&nbsp;4) It is consistent with Python "relevant whitespaces" [indentation<br>is used to define data structure hierarchy]<br><br>I have not yet got to the stage of writing code that use YAML (will take<br>two more weeks at best for me to get to that point), but should you go<br>down this road, I would love to hear back from you. [As I would love to<br>hear from anybody else who might have experience with YAML+Python]<br><br>Some links:<br>- <a href="http://en.wikipedia.org/wiki/YAML" target="_blank">http://en.wikipedia.org/wiki/YAML</a> [good overview of the format]<br>- <a href="http://www.yaml.org/" target="_blank">http://www.yaml.org/</a> [official site... when consistency with the<br>format makes a website hard to browse!]<br>- <a href="http://pyyaml.org/wiki/PyYAMLDocumentation"
 target="_blank">http://pyyaml.org/wiki/PyYAMLDocumentation</a> [documentation of the<br>library for Python - pure Python code // can use a C library]<br><br>An example of YAML file to give you the taste of it:<br>&gt; receipt:&nbsp; &nbsp;&nbsp;&nbsp;Oz-Ware Purchase Invoice<br>&gt; date:&nbsp; &nbsp; &nbsp; &nbsp; 2007-08-06<br>&gt; <br>&gt; customer:<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;given:&nbsp;&nbsp;&nbsp;Dorothy<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;family:&nbsp; Gale<br>&gt; <br>&gt; items:<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;- part_no:&nbsp;&nbsp;&nbsp;A4786<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;descrip:&nbsp;&nbsp;&nbsp;Water Bucket (Filled)<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;price:&nbsp; &nbsp;&nbsp;&nbsp;1.47<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;quantity:&nbsp; 4<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;- part_no:&nbsp;&nbsp;&nbsp;E1628<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;descrip:&nbsp;&nbsp;&nbsp;High Heeled "Ruby" Slippers<br>&gt;&nbsp; &nbsp;
 &nbsp;&nbsp;&nbsp;price:&nbsp; &nbsp;&nbsp;&nbsp;100.27<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;quantity:&nbsp; 1<br>&gt; <br>&gt; bill-to:&nbsp; &amp;id001<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;street: |<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;123 Tornado Alley<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;Suite 16<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;city:&nbsp;&nbsp;&nbsp;East Westville<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;state:&nbsp; KS<br>&gt; <br>&gt; ship-to:&nbsp; *id001<br>&gt; <br>&gt; specialDelivery:&nbsp; &gt;<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;Follow the Yellow Brick<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;Road to the Emerald City.<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;Pay no attention to the<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;man behind the curtain.<br><br>HTH,<br>Mac.<br><br><br>_______________________________________________<br>Tutor maillist&nbsp; -&nbsp; <a ymailto="mailto:Tutor@python.org"
 href="/mc/compose?to=Tutor@python.org">Tutor@python.org</a><br>To unsubscribe or change subscription options:<br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br></div></blockquote></td></tr></table><br>