Troubleshooting: re.finditer() creates object even when nomatch found

Fredrik Lundh fredrik at pythonware.com
Fri Dec 17 16:50:04 EST 2004


Chris Lasher wrote:

> That's odd that there's no built-in method to do this. It seems like
> it would be a common task.

if you do this a lot, maybe you shouldn't use finditer?  iterators are
designed to give you the next item (if any) when you're ready to deal
with it...  if that's not what you want, you can use findall, search loops,
scanner objects, etc.  or you can implement a standard "iterate ahead"
loop.

what's your use case?

</F> 






More information about the Python-list mailing list