<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 10, 2011, at 2:38 AM, Stefan Behnel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Bitstream Vera Sans Mono'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">Note, however, that html5lib is likely way too big to add it to the stdlib, and that BeautifulSoup lacks a parser for non-conforming HTML in Python 3, which would be the target release series for better HTML support. So, whatever library or API you would want to use for HTML processing is currently only the second question as long as Py3 lacks a real-world HTML parser in the stdlib, as well as a robust character detection mechanism. I don't think that can be fixed all that easily.<br></span></span></blockquote></div><div><br></div><div>Here's the problem in a nutshell, I think:</div><div><br></div><div><ol class="MailOutline"><li>Everybody wants an HTML parser in the stdlib, because it's inconvenient to pull in a dependency for such a "simple" task.</li><li>Everybody wants the stdlib to remain small, stable, and simple and not get "overcomplicated".</li><li>Parsing arbitrary HTML5 is a monstrously complex problem, for which there exist rapidly-evolving standards and libraries to deal with it. &nbsp;Parsing 'the web' (which is rapidly growing to include stuff like SVG, MathML etc) is even harder.</li></ol><div><br></div></div><div>My personal opinion is that HTML5Lib gets this problem almost completely right, and so it should be absorbed by the stdlib. &nbsp;Trying to re-invent this from scratch, or even use something like BeautifulSoup which uses a bunch of heuristics and hacks rather than reference to the laboriously-crafted standard that says exactly how parsing malformed stuff has to go to be "like a browser", seems like it will just give the stdlib solution a reputation for working on the test input but not working in the real world.</div><div><br></div><div>(No disrespect to BeautifulSoup: it was a great attempt in the pre-HTML5 world which it was born into, and I've used it numerous times to implement useful things. &nbsp;But much more effort has been poured into this problem since then, and the problems are better understood now.)</div><div><br></div><div>-glyph</div><div><br></div></body></html>