[Python-ideas] Make-statement [Re: Different interface for namedtuple?]

Raymond Hettinger raymond.hettinger at gmail.com
Mon Mar 7 08:24:28 CET 2011

On Mar 6, 2011, at 10:06 PM, Bruce Leban wrote:

> . Personally, the xml writer seems like a reasonable use to me.

I'm surprised that you like the XML writer.  To me it seems much more awkward to type the python code than the XML it generates:

  w = XmlWriter.Create(System.Console.Out,XmlWriterSettings(Indent=True))
  x = XWriter(w)

  with x.element('tableofcontents'):
    with x.element('section',{'page' : '10'}):
    with x.element('section',{'page' : '12'}):
       x.text('Main topic')
    with x.element('section',{'page' : '14'}):
       x.text('Extra topic')


    <section page="10">Introduction</section>
    <section page="12">Main topic</section>
    <section page="14">Extra topic</section>

At least in this example, it seems to me that the XML writer created more work and more complexity than it saved.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110306/f83d719b/attachment.html>

More information about the Python-ideas mailing list