> > > BTW, I don't get the inspiration for the "first" part in those > > > names... it makes you think that there's an order to dictionary > > > items when in reality there isn't. > > > > Actually there is -- the (arbitrary) order revealed by .keys(). > > Hmm, but this can change if you modify the dictionary inside the > loop or if you modify the dictionary from some other thread. Let me explain. When Moshe first proposed a .key() method, I was a bit confused. I thought he wanted a way to get to the i-th key (which can't be done in O(1) time). Then I thought he wanted a way to get a random key. Finally I realized that all he wanted was *a* key, and the first key in the hash table would work fine. Since that's also the first key of .keys(), I figured "first" was an appropriate qualification. Sure, it's not guaranteed to remain the first key, but neither is the first item in a list. That said, getting rid of the first*() suite and adding popitem() instead sounds attractive... --Guido van Rossum (home page: http://www.python.org/~guido/)
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