
4 Dec
2019
4 Dec
'19
10:05 a.m.
On Wed, Dec 4, 2019 at 12:34 AM Serhiy Storchaka storchaka@gmail.com wrote:
`next(re.finditer(...), None)` is a weird way of writing `re.search(...)`.
`next(re.finditer(...), defaults)` is the same as `re.search(...) or defaults`.
Not so fast. re.search() returns a Match object, while re.finditer() and re.findall() return strings. For people who are just interested in strings, the Match object is just a distraction. I think I am +1 on adding re.findfirst() as proposed by the OP.
--
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/