On Wed, Dec 4, 2019 at 12:34 AM Serhiy Storchaka <storch...@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/>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FYHNKUKMA7MPNR6ZR2C4IGVNUQGDA3D4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to