[issue40016] Clarify flag case in `re` module

Terry J. Reedy report at bugs.python.org
Sat Mar 21 16:26:13 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The root confusion is that re compilation has several variations with two sets of indicators, each with an unhelpful exception, and each combined and used in different ways.

1. Module constants with uppercase English words or word pairs, also abbreviated by uppercase letters that are the first letter of the word -- except for S-DOTALL and X-VERBOSE.  As arguments for the flags parameter of functions other than escape and purge, they are combined with '|'.

2. Syntax letters within '(?...)', itself within an regex string, that are the single letter module constants lowercased b -- except that L is not lowercased because some fonts make l and 1 look nearly the same or even identical.  Multiple syntax letters are combined by concatenation.

The additional issue for docstrings is the extreme compression, including the omission (here) of 're.' prefixes.  They are intended as reminders for those who have read and understood the full doc, but we try to make them as clear as possible.  I am working on an alternate revision.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40016>
_______________________________________


More information about the Python-bugs-list mailing list