From: "Just van Rossum" <just@letterror.com> > Fredrik Lundh wrote: > > > if the value has no meaning, why not use a set? how many ways > > do we need to do the same thing? > > True, very true. This basically kills the idea for me. > If I understood correctly the not-so-veiled consideration is that sets are slower and always will be. "The Sets module met several needs centering around set mathematics; however, for membership testing, it is so slow that it is almost always preferable to use dictionaries instead (even without this proposed method). The slowness is intrinsic because of the time to search for the __contains__ method in the class and the time to setup a try/except to handle mutable elements. Another reason to prefer dictionaries is that there is one less thing to import and expect readers to understand. My experiences applying the Sets module indicates that it will *never* replace dictionaries for membership testing and will have only infrequent use for uniquification." So the purist solution would be to work long-term on improving set speed. regards.
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