]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