[docs] Bug in RE module documentation

Gene Wood gene_wood at cementhorizon.com
Wed Aug 24 07:19:04 CEST 2011


http://docs.python.org/library/re.html#re.compile

The doc says : "Compile a regular expression pattern into a regular
expression object, which can be used for matching using its match() and
search() methods, described below."

However if you do a dir of the resulting object under python 2.6 the object
actually supports all of the methods listed in the doc.

I went around trying to figure out how I was going to upgrade to python 2.7
in order to do a multiline "subn" regex and then found a
stackoverflow.comanswer that indicated you could call "subn" from this
object. I then did a
dir on the object and found it supported all the methods.

I suggest you change the doc to either say :

"Compile a regular expression pattern into a regular expression object,
which can be used for matching using its match(), search(), split(),
findall(), finditer(), sub() and subn() methods, described below."

or

"Compile a regular expression pattern into a regular expression object,
which can be used for matching using any of the methods described below."

-Gene Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110823/7433178d/attachment-0001.html>


More information about the docs mailing list