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/2014-January/131997.html below:

[Python-Dev] Wrong keyword parameter name in regex pattern methods

[Python-Dev] Wrong keyword parameter name in regex pattern methodsSerhiy Storchaka storchaka at gmail.com
Thu Jan 23 18:22:56 CET 2014
Currently there is a mismatch between documented parameter names in some 
methods of regex pattern object.

match(), search(), and fullmatch() (the last was added in 3.4) document first 
arguments as "string":

match(string[, pos[, endpos]])
search(string[, pos[, endpos]])
fullmatch(string[, pos[, endpos]])

But actually they don't accept the "string" keyword parameter, by mistake it 
is named as "pattern" in the code.

findall() and split()  document first arguments as "string":

findall(string[, pos[, endpos]]) -> list
split(string[, maxsplit = 0])

But actually they don't accept the "string" keyword parameter, it is named as 
"source" in the code.

The scanner() method is not documented and also has the "source" parameter.

All other methods accepts the "string" argument as documented. The match 
object returned by match(), search(), fullmatch(), and finditer() methods and 
generated by the scanner, has the "string" attribute which is equivalent to 
the argument of these methods. Module level functions which corresponds to 
these methods have the "string" parameter.

Due to all these facts I think that parameter names "pattern" and "source" are 
accidental mistakes and should be renamed to expected "string". Because this 
parameter is mandatory, apparently it is always used as positional parameter, 
and this error was not discovered long time.

http://bugs.python.org/issue20283
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