On Tuesday, June 28, 2011 10:19:08 AM UTC-4, apple wrote: 
>
> Thanks. Why not define the + and += operator for tags? 
>
> It seems a lot more intuitive to say table+=row 
>
> rather than table=TAG[''](table+row)

 
Note, it would be TAG[''](table, row), not TAG[''](table+row).
 
Helpers (as well as strings) are always concatenated whenever you put them 
inside another helper. For example:
 
SPAN('some text', A('link', _href='/a/c/f'), B('bold text'))
 
will concatenate all the elements inside the SPAN object.
 
I suppose you could define your own tag, NOTAG=TAG['']. Then you could do:
 
>>> NOTAG=TAG['']
>>> html=NOTAG('one',B('two'),'three')
>>> print html
one<b>two</b>three
>>> html.append(A('four', _href='/a/c/f'))
>>> print html
one<b>two</b>three<a href="/a/c/f">four</a>
 
Anthony

Reply via email to