"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > > Nick Coghlan wrote: > > > I also like Josiah's idea of replacing find() with a search() method > > that returned an iterator of indices, so that you can do: > > > > for idx in string.search(sub): > > # Process the indices (if any) > > Need to be careful with this - the original search proposal returned a > list, which could be tested for a boolean value - hence: > > if not string.search(sub): > pass > > but if an iterator were returned, I think we would want to be able to > perform the same test i.e. search would have to return an iterator that > had already performed the initial search, with __nonzero__ reflecting > the result of that search. I do think that returning an iterator is > better due to the fact that most uses of search() would only care about > the first returned index.
... which is why there is a count argument, that I have recently suggested default to 1. - Josiah _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
