<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 ---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><quasipedia@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Mac Ryan <quasipedia@gmail.com><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>> I am making a data processing program that will use a configuration<br>> file. The file should contain information about: (1) source files<br>> used, (2) (intermediate) output files, (3) used parameters/estimation<br>> methods (4) manual data edits + datetime stamp + user name . I'd like<br>> to store this config file in xml. However, I've never created<br>> something like this before. Is this a suitable format, and, if so,<br>> what
would the elementtree look like? Should I just use 'config' or<br>> something similar as root, and the information elements 1 through 3 as<br>> child elements? And should the manual edits be stored as an element<br>> 'edit' with various attributes (the edit itself, the time stamp,<br>> 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> 1) It is easy to read and edit by humans
[think "markdown"]<br> 2) It has solid parsing libraries for Python<br> 3) It is far less verbose than XML<br> 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>> receipt: Oz-Ware Purchase Invoice<br>> date: 2007-08-06<br>> <br>> customer:<br>> given: Dorothy<br>> family: Gale<br>> <br>> items:<br>> - part_no: A4786<br>> descrip: Water Bucket (Filled)<br>> price: 1.47<br>> quantity: 4<br>> - part_no: E1628<br>> descrip: High Heeled "Ruby" Slippers<br>>
price: 100.27<br>> quantity: 1<br>> <br>> bill-to: &id001<br>> street: |<br>> 123 Tornado Alley<br>> Suite 16<br>> city: East Westville<br>> state: KS<br>> <br>> ship-to: *id001<br>> <br>> specialDelivery: ><br>> Follow the Yellow Brick<br>> Road to the Emerald City.<br>> Pay no attention to the<br>> man behind the curtain.<br><br>HTH,<br>Mac.<br><br><br>_______________________________________________<br>Tutor maillist - <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>