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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com