[issue44940] Hint the use of non-capturing group in re.findall() documentation

Vedran Čačić report at bugs.python.org
Thu Aug 19 07:28:18 EDT 2021


Vedran Čačić <vedgar at gmail.com> added the comment:

Ah, now I see. When some_match.group(0) is called, the whole match is returned. So match can be considered kinda group (quasigroup?:). I see how it can be confusing: python usually starts indexing at 0, and someone might think that a .group(0) would be included in "a list of groups" returned.

I'm not sure how best to fix it. Maybe: Alternatively, if grouping parentheses are present in the pattern, return a list of groups captured by them...

----------

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


More information about the Python-bugs-list mailing list