Issue 35846: Incomplete documentation for re.sub (original) (raw)

Issue35846

Created on 2019-01-29 08:06 by pbugnion, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg334504 - (view) Author: Pascal Bugnion (pbugnion) Date: 2019-01-29 08:06
The documentation for `re.sub` states that "Unknown escapes such as ``\&`` are left alone.". This is only true for escapes which are not ascii characters, as far as I can tell (c.f. source on https://github.com/python/cpython/blob/master/Lib/sre_parse.py#L1047). Would there be value in amending that documentation to either remove that sentence or to clarify it? If so, I'm happy to submit a PR on GitHub.
msg334642 - (view) Author: Windson Yang (Windson Yang) * Date: 2019-02-01 01:46
I wonder if possible that c not in ASCIILETTERS when we get KeyError? if c in ASCIILETTERS: raise s.error('bad escape %s' % this, len(this))
msg335543 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-02-14 16:47
This is a duplicate of .
History
Date User Action Args
2022-04-11 14:59:10 admin set github: 80027
2019-02-14 16:47:40 serhiy.storchaka set status: open -> closedsuperseder: Misleading/inaccurate documentation about unknown escape sequences in regular expressionsnosy: + serhiy.storchakamessages: + resolution: duplicatestage: resolved
2019-02-01 01:46:34 Windson Yang set nosy: + Windson Yangmessages: +
2019-01-29 08:06:08 pbugnion create