On Monday, December 5, 2011 4:13:01 AM UTC+8, Ian wrote: > On Sun, Dec 4, 2011 at 11:06 AM, 88888 Dihedral > <dihedr...@googlemail.com> wrote: > >> If you want to talk about ways to use dicts, please start a different > >> thread for it. As has been pointed out several times now, it is > >> off-topic for this thread, which is about hash *functions*. > > > > A hash that can hash objects is not a hash function at all. > > 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. -- http://mail.python.org/mailman/listinfo/python-list