[docs] RegexObject findall, finditer docs misleading

Sean Silva chisophugis at gmail.com
Wed May 25 20:36:56 CEST 2011


On RegexObjects, finditer returns an iterator over MatchObjects, whereas
findall returns a list of *strings*. This isn't mentioned anywhere in their
documentation, but it is a pretty big distinction.

To my knowledge, they are interconnected by this equivalence:
re_obj.findall(string, pos, endpos) <=> [m.group(0) for m in
re_obj.finditer(string, pos, endpos)]

Hopefully that can be clarified, because it tripped me up, and I'm sure I'm
not the only one!

--Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110525/a6ca2184/attachment-0001.html>

More information about the docs mailing list