Overloading equality in Python

Опубликовано: 18 Сентябрь 2023
на канале: Python Morsels
287
13

Want to customize what "equality" means for your class instances in Python? Implement a `__eq__` method! Make sure to return `NotImplemented` as appropriate though.

https://pym.dev/overloading-equality-...

Find more Python screencasts at https://pym.dev/screencasts/

00:00 The default implementation for equality is the same as identity
00:35 How does the == operator work behind the scenes in Python?
01:19 Customizing how equality works with the _eq_ method
02:10 Using type-checking in equality to ensure that the two objects are comparable
03:15 Summary


На этой странице сайта вы можете посмотреть видео онлайн Overloading equality in Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Python Morsels 18 Сентябрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 287 раз и оно понравилось 13 зрителям. Приятного просмотра!