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)