Source formatting for long expressions.

Michael Gilfix mgilfix at eecs.tufts.edu
Tue Jun 11 13:20:03 EDT 2002


On Tue, Jun 11 @ 10:32, Christopher Armstrong wrote:
> XML is a terrible format for object persistence, due to the lack of robust
> mappings. Twisted's XML uses attributes in some cases, but that is only
> possible when you have string:string mappings. In *any* other case, you
> have to resort to children nodes, with such ugly syntax as::
> 
> <instance class="twisted.some.Class">
> <dictionary>
>   <string role="key" value="someAttr" />
>   <list>
>     <string value="foo" />
>   </list>
> </dictionary>
> 
> Compare that with the equivalent AOT format::
> 
> Instance("twisted.some.Class", 
>   someAttr=["foo"],
> )
> 
> *That* is why I don't just use XML.

  I'm not disagreeing with you because I don't think you're wrong in
this case and well, XML isn't for everything. I think XML can work
here just as well but it's just more work. I'm not sure about the
lack of robustness of the mappings - you just have to define them and
can use a DTD to verify that your mappings are intact. But you have
to write extra code for the mappings that isn't quite worth it in
such a domain specific case. XML costs extra for being general.  Er,
you don't have any between version/backwards-compat issues though do
you? In which case, have you thought those out thoroughly?  Forgive me
if it isn't relavent. Not sure exactly where these will be used.

                    -- Mike

-- 
Michael Gilfix
mgilfix at eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html





More information about the Python-list mailing list