Python 3.2 and html.escape function

Peter Otten __peter__ at
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

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

More information about the Python-list mailing list