Tim Hochberg wrote:
> Tim Hochberg wrote:
>> I don't think that's correct. I think that with a suitably designed
>> HtmlDocument object, the following should be possible:
>>
>> with HtmlDocument("Title") as doc:
>> with doc.element("body"):
>> doc.text("before first h1")
>> with doc.element("h1", style="first"):
>> doc.text("first h1")
>> # I don't understand the point of tail, but you could do that too
>> doc.text("after first h1")
>> with doc.element("h1", style="second"):
>> doc.text("second h1")
>> doc.text("after second h1")
>>
> Here's code to do this. It would be probably be better to use elment
> tree or some such instead of pushing out the HTML directly, but this
> should get the idea across (testing using 2.5a1):
[snip]
Thanks, that's great! If you don't mind, I'm going to steal your code
for the PEP. I think it makes a pretty good case against expanding the
statement semantics to include customizing the dict in which the code is
executed.
STeVe
--
http://mail.python.org/mailman/listinfo/python-list