On Fri, Dec 08, 2000 at 01:43:39PM -0500, Guido van Rossum wrote: >... > Comments please! We could: > > - Live with the pathological cases. I agree: live with it. The typical case will operate just fine. > - Forget the whole thing; and then also forget about firstkey() > etc. which has the same problem only worse. No opinion. > - Fix the algorithm. Maybe jumping criss-cross through the hash table > like lookdict does would improve that; but I don't understand the > math used for that ("Cycle through GF(2^n)-{0}" ???). No need. The keys were inserted randomly, so sequencing through is effectively random. :-) >... > static PyObject * > dict_popitem(dictobject *mp, PyObject *args) > { > static int finger = 0; > int i; > dictentry *ep; > PyObject *res; > > if (!PyArg_NoArgs(args)) > return NULL; > if (mp->ma_used == 0) { > PyErr_SetString(PyExc_KeyError, > "popitem(): dictionary is empty"); > return NULL; > } > i = finger; > if (i >= mp->ma_size) > ir = 0; Should be "i = 0" Cheers, -g -- Greg Stein, http://www.lyra.org/
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