classification
Title: Bad parameter name in re.escape()
Type: enhancement Stage: resolved
Components: Regular Expressions Versions: Python 3.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, mandeepb, mrabarnett, r.david.murray, rhettinger, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-04-11 20:28 by serhiy.storchaka, last changed 2017-04-13 07:44 by serhiy.storchaka. This issue is now closed.

Messages (4)
msg291514 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-11 20:28
Currently re.escape() parameter has a name "pattern", but in the documentation the name of the parameter is "string".

The name "pattern" is not correct, and maybe even misleading. The argument of escape() is not a pattern, it is an arbitrary string, and escape() makes a pattern from it by escaping special characters.

It is unlikely that the argument is passed to re.escape() by keyword. Therefore renaming it to "string" shouldn't break existing code.
msg291524 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-04-12 01:31
"Pattern" seems right to me.
msg291589 - (view) Author: Mandeep Bhutani (mandeepb) * Date: 2017-04-13 04:34
I agree that pattern seems right. However I think that the parameter in the docs should be changed from string to pattern for consistency purposes.
msg291591 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-13 07:44
This looked not correct to me but if you say "pattern" seems right I'm closing this issue.

I'll update the parameter name in PR 1048.
History
Date User Action Args
2017-04-13 07:44:50serhiy.storchakasetstatus: open -> closed
resolution: works for me
messages: + msg291591

stage: resolved
2017-04-13 04:34:45mandeepbsetnosy: + mandeepb
messages: + msg291589
2017-04-12 01:31:35rhettingersetnosy: + rhettinger
messages: + msg291524
2017-04-11 20:28:24serhiy.storchakacreate