On Monday, December 5, 2011 7:24:49 AM UTC+8, Ian wrote: > On Sun, Dec 4, 2011 at 4:17 PM, 88888 Dihedral > <dihedr...@googlemail.com> wrote: > >> Please explain what you think a hash function is, then. Per > >> Wikipedia, "A hash function is any algorithm or subroutine that maps > >> large data sets to smaller data sets, called keys." > >> > >> > Are you miss-leading the power of true OOP ? > >> > >> I have no idea what you are suggesting. I was not talking about OOP at > >> all. > > > > In python the (k,v) pair in a dictionary k and v can be both an objects. > > v can be a tuple or a list. There are some restrictions on k to be an > > hashable type in python's implementation. The key is used to compute the > > position of the pair to be stored in a hash table. The hash function maps > > key k to the position in the hash table. If k1!=k2 are both mapped to the > > same > > position, then something has to be done to resolve this. > > I understand how dicts / hash tables work. I don't need you to > explain that to me. What you haven't explained is why you stated that > a hash function that operates on objects is not a hash function, or > what you meant by "misleading the power of true OOP".
Do you forget the memory management of a dictionary in Python that has to be linked for a dynamical growing and shrinking number of (k,v) pairs in a long period of time? Avoiding the true non-trivial part in any implementation or use of a dictionary is miss leading ? Probing too deep in the stack or occupying too much in the heap is not bug free? -- http://mail.python.org/mailman/listinfo/python-list