XML overuse? (was Re: Python to XML to Python conversion)

François Pinard pinard at iro.umontreal.ca
Sun Jul 14 13:01:34 EDT 2002


[Jonathan Hogg]

> [...] I consider XML to be "standardised" not because the W3C said so,
> but because parsing, validating, querying, and transforming frameworks
> are available for nearly any language off-the-shelf, editors support it,
> and database and data manipulation tools support it.  I'm afraid Pickle
> doesn't come close in this regard (and isn't human readable anyway).

I can read a pickle with Python and dump it as a readable, pretty-printed
Python structure.  Conversely, I can have Python to read in a text containing
the source of a Python structure, and produce a pickle from the result.
The programs to do so are very small.  In practice, I do not maintain my
original structures as pickles, but rather as very straight Python source
files containing about nothing but data structures.  These are easy to edit.

For most people, even to those not familiar with Python, a Python
structured constant is probably easier to read that any XML rendering of it.
Python will parse and validate it for me.  I can save the original text,
or the pickle if I prefer so, in files and databases, and transmit either
over networks.  Python, the language, is also a wonderful and probably
unequalled generic framework for transforming data structures.

About being compatible with "nearly any language off-the-shelf", of
course, is where some difficulty may rise.  Until I have this problem,
I'll rather stay comfortable with Python than push myself into miseries
I do not need.  Then, I could decide to transmit either lines and fields,
or XML if available at the other end, or even analyse and produce source
or data files for the other language, probably all from within Python.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list