GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • [ date ]
  • [ thread ]
  • [ subject ]
  • [ author ]

This view

  • Original page
  • New address

GeezerVison is showing mail.python.org — [Python-Dev] Wrong keyword parameter name in regex pattern methods

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

Serhiy Storchaka storchaka at gmail.com
Thu Jan 23 18:22:56 CET 2014

  • Previous message: [Python-Dev] Enable Hostname and Certificate Chain Validation
  • Next message: [Python-Dev] Wrong keyword parameter name in regex pattern methods
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

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

  • Previous message: [Python-Dev] Enable Hostname and Certificate Chain Validation
  • Next message: [Python-Dev] Wrong keyword parameter name in regex pattern methods
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the Python-Dev mailing list
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.