[New-bugs-announce] [issue37110] Clarify hashability of custom class instances

Christoph Zwerschke report at bugs.python.org
Fri May 31 05:07:25 EDT 2019


New submission from Christoph Zwerschke <cito at online.de>:

The Python documentation says about hashability in the glossary (https://docs.python.org/3/glossary.html#term-hashable):

"Objects which are instances of user-defined classes are hashable by default."

This is not quite true. Objects of a user-defined class with an __eq__ method are not hashable. Maybe it would be better to make this more explicit:

"Objects which are instances of user_defined classes without custom __eq__ and __hash__ methods are hashable by default."

----------
assignee: docs at python
components: Documentation
messages: 344042
nosy: cito, docs at python
priority: normal
severity: normal
status: open
title: Clarify hashability of custom class instances
type: enhancement
versions: Python 3.8

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


More information about the New-bugs-announce mailing list