The Python Oracle

Compare object instances for equality by their attributes

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops

--

Chapters
00:00 Question
00:49 Accepted answer (Score 466)
02:37 Answer 2 (Score 53)
03:07 Answer 3 (Score 21)
07:26 Answer 4 (Score 11)
07:59 Thank you

--

Full question
https://stackoverflow.com/questions/1227...

Accepted answer links:
[__eq__]: https://docs.python.org/3/reference/data...
[__hash__]: https://docs.python.org/3/reference/data...
[__cmp__]: https://portingguide.readthedocs.io/en/l...
[__ne__]: https://docs.python.org/2/reference/data...

Answer 2 links:
[rich comparison operators]: https://docs.python.org/2.7/reference/da...

Answer 3 links:
[pickle]: https://stackoverflow.com/questions/7501...

Answer 4 links:
[Dataclasses in Python 3.7]: https://docs.python.org/3.7/library/data...
[backport for Dataclasses]: https://pypi.org/project/dataclasses/

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #equality

#avk47