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

Veröffentlicht am: 10 November 2021
auf dem Kanal: 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!


Auf dieser Seite können Sie das Online-Video Python Classes - Class Customization and Rich Comparison Methods with Code Example - APPFICIAL mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Appficial 10 November 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,721 Mal angesehen und es wurde von 34 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!