> BTW, one lesson to take from SETL: a vital set operation in practice is a > mutating "pick a 'random' element E from the set, remove it from the set, > and return it". An enormous number of set algorithms are of the form > > while not S.empty(): > pick some element from S > deal with it, possibly mutating S > > This operation can't be done efficiently in Python code if the set is > represented by a dict (the best you can do is materialize the full list of > keys first, and pick one of those). That means my Set class often takes > quadratic time for what *should* be linear-time algorithms. Hmmm...actually, I've been wanting a method .key() for dictionaries a long time. So if we give dictionaries this one small method, then we *can* do this in Python. -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!
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