6 Dec
2019
6 Dec
'19
2:12 a.m.
It’s unfortunate that these functions aren’t better matched. Why is there a simple-semantics find-everything and a match-semantics find-iteratively and find-one? But I don’t think adding a simple-semantics find-one that works by inefficiently finding all is the right solution.
The proposed implementation for *findfirst()* is: *return next(finditer(pattern, text, flags=flags), default=default)*
And if the point of proposing first is that novices will figure out how to write first(findall(…)) so we don’t need to add findfirst, then I think we need findfirst even more, because novices shouldn’t learn that bad idea.
I posted another thread to argue in favor of *first()*, independently of *findfirst().* -- Juancarlo *Añez*