A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-May/065396.html below:

[Python-Dev] Let's stop eating exceptions in dict lookup

[Python-Dev] Let's stop eating exceptions in dict lookupArmin Rigo arigo at tunes.org
Tue May 30 00:35:57 CEST 2006
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.
More information about the Python-Dev mailing list

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