On 7/27/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 7/27/06, Steven Bethard <[EMAIL PROTECTED]> wrote:
> > If I understand the problem right, the reason for not wanting to
> > remove __hash__ from object is that it's often convenient to have a
> > dict or set where objects are compared by id() instead of by value.
>
> No, not at all. This is for objects whose __eq__ is also the default
[snip]
So what's the problem with losing the default hash then? I thought
the default hash was basically just hash(id(obj))::
>>> class C(object):
... pass
...
>>> hash(C)
13565672
>>> hash(id(C))
13565672
>>> c = C()
>>> hash(c)
15130928
>>> hash(id(c))
15130928
If object.__hash__() disappeared, the hash(obj) versions would fail,
but the same results seem to be available as hash(id(obj)).
Steve
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com