Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5870
| Date | 2011-05-20 11:46 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: hash values and equality |
| References | (3 earlier) <BANLkTintqgBLFtBx8+1b+R10nywuKdKHOw@mail.gmail.com> <4DD2F661.2050005@stoneleaf.us> <BANLkTikx8U4jWwLXXazpmtsL6MasDmyVyg@mail.gmail.com> <BANLkTi=_GqrNntRU7pv7x=kj3gHurk-Gaw@mail.gmail.com> <4DD5FF8F.604@stoneleaf.us> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1852.1305916429.9059.python-list@python.org> (permalink) |
Ethan Furman wrote: > Several folk have said that objects that compare equal must hash equal, > and the docs also state this > http://docs.python.org/dev/reference/datamodel.html#object.__hash__ Two things I didn't make clear originally: I'm using Python3. My objects (of type Wierd) obey the premise of comparing equal also meaning hashing equal (with other objects of type Wierd). Perhaps my question could be narrowed down to: Should the docs actually say that "objects of the same *type* that compare equal must hash equal", or is there an underlying reason that objects of *different types* that happen to compare equal *must not* have different hashes? In other words, is the fact that everything tried so far in Python3 to break my toy code has failed to do so just an implementation detail of Python3? ~Ethan~
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: hash values and equality Ethan Furman <ethan@stoneleaf.us> - 2011-05-20 11:46 -0700
csiph-web