[docs] [issue37110] Clarify hashability of custom class instances

Raymond Hettinger report at bugs.python.org
Fri May 31 19:00:39 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

The docs look correct to me:

    >>> class A:
            pass

    >>> hash(A())
    274859987

User defined classes are in-fact hashable by default.  Other methods can be defined to change hashability, but they are not the default.

FWIW, it isn't the purpose of the glossary to be a language spec; rather, it is to provide a rough meaning of what the word "hashable" means.  Already, the wording has exceeded its original intent.  The correct place for a more detailed specification in the language reference for object.__hash__():

   https://docs.python.org/3/reference/datamodel.html?highlight=__hash__#object.__hash__

Thank you for the suggestion, but we'll pass on this one.

----------
assignee: docs at python -> rhettinger
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37110>
_______________________________________


More information about the docs mailing list