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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com