Hello,
Is there any way that I can find the hash value of a class from an
instance?
>>> class A:
... pass
...
>>> a = A()
>>> hash(A)
10782976
>>> hash(a)
12251904
>>>
What I want is a function that returns the value of 'hash(A)':
> a.getHashOfClass()
10782976
Is this possible?
/Joakim
--
Hello,
Is there any way that I can find the hash value of a class from an
instance?
>>> class A:
... pass
...
>>> a = A()
>>> hash(A)
10782976
>>> hash(a)
12251904
>>>
What I want is a function that returns the value of 'hash(A)':
> a.getHashOfClass()
10782976
Is this possible?
/Joakim
--
Thanks!
Not so strange I think, the hash values of classes will be used as keys
in a dictionary that serve as an object pool.
Sorry about the double posting, I got a 'server error' message the
first time, so I figured it hadn't gone trhough.
/Joakim
--
http://mail.python.org/mailman/listinfo/p
So I guess it might be a little bit less unwise to use id() instead
then...
/Joakim
--
http://mail.python.org/mailman/listinfo/python-list
Simply because it didn't occur to me. So now I have
>>> class A: pass
...
>>> d = {A:[A(),A(),A()]}
>>> a = d[A].pop()
>>> a
<__main__.A instance at 0x00F09A58>
>>>
Thanks all!
/Joakim
--
http://mail.python.org/mailman/listinfo/python-list