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. [steve@sylar ~]$ python3.2 Python 3.2a1 (r32a1:83318, Aug 12 2010, 02:17:22) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import html >>> help(html) which gives me the following information: Help on package html: NAME html - # This directory is a Python package. FILE /usr/local/lib/python3.2/html/__init__.py MODULE DOCS http://docs.python.org/library/html PACKAGE CONTENTS entities parser So html is not a module, but a package that includes two sub-modules, entities and parser. I see no sign of anything called "escape" in either the top level html package, or either of the sub-modules, and the word "escape" only appears twice in the whole package, both times as "unescape": [steve@sylar ~]$ cd /usr/local/lib/python3.2/html/ [steve@sylar html]$ ls entities.py __init__.py parser.py __pycache__ [steve@sylar html]$ grep -i escape *.py parser.py: attrvalue = self.unescape(attrvalue) parser.py: def unescape(self, s): So I don't know what you are looking at, but I don't believe it is the standard html package in the Python standard library. Perhaps you have accidentally shadowed it with your own html module? Try this: >>> import html >>> html.__file__ '/usr/local/lib/python3.2/html/__init__.py' -- Steven -- http://mail.python.org/mailman/listinfo/python-list