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/2002-May/024808.html below:

[Python-Dev] Other library code transformations

[Python-Dev] Other library code transformations [Python-Dev] Other library code transformationsTim Peters tim.one@comcast.net
Fri, 31 May 2002 13:04:08 -0400
]Raymond Hettinger]
>> if item in astring --> if item in adict

[Guido]
> Huh?  What does this mean?

I assume the only point is speed.  Provided there are no collisions, "in" on
a character-keyed dict acting as a set is faster than "in" applied to a
string, even if the character searched for is the first character in the
target string.  But it's only a little faster then today.  It's about 50%
faster by the time you have to search ~= 50 characters into a string before
finding a hit.  However, most uses of "character in string" have very short
"string" parts (like "ch in '/\\'"), and I don't judge the minor speed gain
there worth the extra bother and obscurity of maintaining a static set
(dict).





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