Python 3.2 and html.escape function

Peter Otten __peter__ at web.de
Sun Feb 20 15:33:39 CET 2011


Steven D'Aprano wrote:

> On Sun, 20 Feb 2011 08:15:35 -0500, Gerald Britton wrote:
> 
>> I see that Python 3.2 includes a new module -- html -- with a single
>> function -- escape.  I would like to know how this function differs from
>> xml.sax.saxutils.escape and, if there is no difference (or only a minor
>> one), what the need is for this new module and its lone function
> 
> Unless the html API has changed radically since Python 3.2a, I believe
> you are mistaken.

Adding a function is not /that/ radical, and it has happened, see

http://docs.python.org/dev/py3k/library/html.html

The check-in message that is linked there claims that html.escape() is 
supposed to replace cgi.escape()

Side note: there has been a discussion whether it's a good idea to put a 
function into a package, see

http://mail.python.org/pipermail/python-dev/2011-January/107635.html



More information about the Python-list mailing list