This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients Imagist, LambertDW, ezio.melotti
Date 2009-02-27.18:25:07
SpamBayes Score 0.00079387095
Marked as misclassified No
Message-id <1235759109.42.0.413847125321.issue5383@psf.upfronthosting.co.za>
In-reply-to
Content
> xhtmlNode('div','Hello, world',id='sidebar')

> ... but this would not have symmetry with the generated xhtml and 
> therefore complicates the code.  The solution, in my opinion, is to 
> allow varargs to be intermixed with keyword args.  The above real-world 
> example shows a use-case for this more flexible functionality.

IMHO your API is confusing in the first place, if xhtmlNode is supposed
to create an XHTML element (possibly with attributes), why would you
want to pass also the content as a positional argument?

I would probably keep the element and its content separate and do
something like:
div = xhtmlNode('div', **attributes)
div.add(TextNode('Hello World'))

or, if you want a shortcut:
xhtmlNode('div', id='sidebar', content='Hello world') or
xhtmlNode('div', id='sidebar', text='Hello world')
History
Date User Action Args
2009-02-27 18:25:09ezio.melottisetrecipients: + ezio.melotti, LambertDW, Imagist
2009-02-27 18:25:09ezio.melottisetmessageid: <1235759109.42.0.413847125321.issue5383@psf.upfronthosting.co.za>
2009-02-27 18:25:07ezio.melottilinkissue5383 messages
2009-02-27 18:25:07ezio.melotticreate