[docs] Improved documentation for re.findall()

anatoly techtonik techtonik at gmail.com
Tue Jul 8 09:29:15 CEST 2014


Hi,

The documentation on findall() requires full reading
to understand that return type is not only list of strings.
https://docs.python.org/2/library/re.html#re.findall


I propose to change from:

Return all non-overlapping matches of pattern in string, as a list of strings.
The string is scanned left-to-right, and matches are returned in the
order found.
If one or more groups are present in the pattern, return a list of groups; this
will be a list of tuples if the pattern has more than one group. Empty matches
are included in the result unless they touch the beginning of another match.


To:

Find all non-overlapping matches of pattern in string. The string is scanned
left-to-right, and matches are returned in the order found. Returns list of
strings if no groups or one group is present in the pattern. It there are
more groups - returns list of tuples. Empty matches are included in the result
unless they touch the beginning of another match.


-- 
anatoly t.


More information about the docs mailing list