Hi Fredrik, On Tue, May 30, 2006 at 12:23:04AM +0200, Fredrik Lundh wrote: > well, the empty string is a valid substring of all possible strings > (there are no "null" strings in Python). you get the same behaviour > from slicing, the "in" operator, "replace" (this was discussed on the > list last week), "count", etc. > > if you're actually searching for a *non-empty* string, find() will > always return -1 sooner or later. I know this. These corner cases are debatable and different answers could be seen as correct, as I think is the case for find(). My point was different: I was worrying that the recent change in str.find() would needlessly send existing and working programs into infinite loops, which can be a particularly bad kind of failure for some applications. At least, it gave a 100% performance loss on the benchmark I was trying to run :-) A bientot, Armin.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4