On 12/05/2011 11:52 AM, 88888 Dihedral wrote:
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".
If v is a tuple or a list then a dictionary in python can replace a
bi-directional list or a tree under the assumption that the hash which
accesses values stored in a much faster way when well implemented.
trying not to be rude, but the more you talk, the more I"m convince that
you're trolling. Welcome to my killfile.
--
http://mail.python.org/mailman/listinfo/python-list