New submission from Max:

http://docs.python.org/dev/glossary.html?highlight=hashable says:

Objects which are instances of user-defined classes are hashable by default; 
they all compare unequal, and their hash value is their id().

Since x == x returns True by default, so "they all compare unequal" isn't quite 
right.

In addition, both the above paragraph and 
http://docs.python.org/dev/reference/datamodel.html?highlight=__eq__#object.__hash__
 say:

User-defined classes have __eq__() and __hash__() methods by default; with 
them, all objects compare unequal (except with themselves) and x.__hash__() 
returns an appropriate value such that x == y implies both that x is y and 
hash(x) == hash(y).

This is correct, but may leave some confusion with the reader about what 
happens to a subclass of a built-in class (which doesn't use the default 
behavior, but instead simply inherits the parent's __hash__ and __eq__).

----------
assignee: docs@python
components: Documentation
messages: 171935
nosy: docs@python, max
priority: normal
severity: normal
status: open
title: hashable documentation error
type: enhancement
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16128>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to