Ouch, that's a problem indeed. There's not really a clean way out unfortunately: either we remove object.__hash__ and let hash() do the default implementation, and then presence of __hash__ is no longer an indicator of hashability; or we keep it, and override it to raise an exception in unhashable types (like list.__hash__ does); or we remove the hashability of objects by default, which lets us solve the above problems at the cost of having a convenient hash by default.
Personally, I'm not sure this problem needs solving; I don't recall ever needing to know whether something is hashable. So perhaps it's of purely theoretical importance? That would suit me fine given the above dilemma... --Guido On 7/23/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > I propose to take the same approach as for callable: if it has > > __hash__ we consider it hashable even though the hash may fail > > Fair enough, although since object has __hash__ > we end up concluding that everything is > hashable except when it isn't. :-) > > -- > Greg > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com