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

Bruce Leban bruce at leapyear.org
Mon Mar 7 09:20:37 CET 2011


On Sun, Mar 6, 2011 at 11:24 PM, Raymond Hettinger <
raymond.hettinger at gmail.com> wrote:

>
> 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:
>
> <snip>
>


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

I agree for this example. In real code, it wouldn't all be static. It would
be like:

with x.element('foo'):
  for a in stuff:
    with x.element('bar'):
      a.render(x)


I like that better than something like this:

x.write(x.element('foo', [x.element('bar', a.render()) for a in stuff]))


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


More information about the Python-ideas mailing list