A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-May/089740.html below:

[Python-Dev] Arguments of MatchObject in re module

[Python-Dev] Arguments of MatchObject in re module [Python-Dev] Arguments of MatchObject in re moduleMRAB google at mrabarnett.plus.com
Tue May 26 01:50:58 CEST 2009
I've just noticed an oddity of the re module while looking at the
sources. I'll illustrate it below:

 >>> import re
 >>> p = re.compile("foo")
 >>> help(p.match)
Help on built-in function match:

match(...)
     match(string[, pos[, endpos]]) --> match object or None.
     Matches zero or more characters at the beginning of the string

 >>> p.match(string="foo")

Traceback (most recent call last):
   File "<pyshell#8>", line 1, in <module>
     p.match(string="foo")
TypeError: Required argument 'pattern' (pos 1) not found
 >>>

The name of the first argument should be "string", yet it's "pattern".
Does anyone know if it's anything other than a mistake? Should it be
fixed in the next version of the re module, or are we just stuck with it
(and should just change the docstring to match)?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4