[Web-SIG] htmlgen

Simon Willison cs1spw at bath.ac.uk
Wed Oct 29 23:01:51 EST 2003

Gregory (Grisha) Trubetskoy wrote:
>>Can you describe what HTMLgen does?
>>>>from HTMLgen import *
>>>>ul = UL(["blah", "blah"])
>>>>ul.append(H(1, "bleh"))
>>>>print ul
> <UL>
> <LI>blah
> <LI>blah
> <LI><H1>bleh</H1>
> </UL>

A big problem here is one of style. I prefer my HTML to be lower case 
with explicit end tags (even when optional), and often work in XHTML 
where end tags are required. I also like my lists to have their <li>s 
indented with 2 spaces.

The point I'm trying to make is that different people have different 
preferences for HTML, and there is no one correct way of writing it. 
This is why I'm opposed to HTML generation tools in the standard library 
- there are simply too many styles. HTML generation tools already exist 
outside the standard library in abundance and I see no pressing need for 
the default Python install to ship with one that has been chosen over 
all of the others.

If there's an obvious demand from Python's user base for an HTML 
generation system in the standard library then by all means there should 
be one, but I don't see any reason to include one without good reason 
when there is no obviously "correct" way of going about it.

Simon Willison
Web development weblog: http://simon.incutio.com/

More information about the Web-SIG mailing list