Re: Dictionary Keys question
- From: Marc 'BlackJack' Rintsch <bj_666@xxxxxxx>
- Date: 31 Jan 2008 07:43:28 GMT
On Wed, 30 Jan 2008 17:19:13 -0800, Ryszard Szopa wrote:
BTW, can anybody explain me how is the hash function implemented in
Python?
It calls the `__hash__()` method on the object that was given as argument.
So there's not *the* hash function, but every type implements its own.
Fallback is the hash of the identity of an object:
In [415]: class A(object): pass
.....:
In [416]: a = A()
In [417]: hash(a)
Out[417]: 161029068
In [418]: hash(id(a))
Out[418]: 161029068
Ciao,
Marc 'BlackJack' Rintsch
.
- References:
- Dictionary Keys question
- From: FireNWater
- Re: Dictionary Keys question
- From: Dustan
- Re: Dictionary Keys question
- From: Ryszard Szopa
- Dictionary Keys question
- Prev by Date: Re: Removing Pubic Hair Methods
- Next by Date: list traversal and remove
- Previous by thread: Re: Dictionary Keys question
- Next by thread: Re: Dictionary Keys question
- Index(es):