Python Classes - Class Customization and Rich Comparison Methods with Code Example - APPFICIAL

Опубликовано: 10 Ноябрь 2021
на канале: Appficial
1,721
34

Class customization allows you to define how a class behaves for specific operations such as printing or accessing attributes

Customize classes by creating instances methods using special method names (double underscores)

Rich comparison methods overload some common comparison operators. They allow you to overload the logical operators.

Rich comparison method / Overloaded operator
__lt__(self, other) / Less than
__le__(self, other) / Less than or equal-to
__gt__(self, other) / Greater than
__ge__(self, other) / Greater than or equal-to
__eq__(self, other) / Equal to (==)
__ne__(self, other) / Not equal to (!=)

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!


На этой странице сайта вы можете посмотреть видео онлайн Python Classes - Class Customization and Rich Comparison Methods with Code Example - APPFICIAL длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Appficial 10 Ноябрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,721 раз и оно понравилось 34 зрителям. Приятного просмотра!