If you want to overload the less than (<) operator for a class, you will define the _______ method in your class.
- __compare__
- __less__
- __lessthan__
- __lt__
To overload the less than (<) operator for a class, you define the __lt__ (less than) method in your class. This method is called when the "<" operator is used with objects of the class.
Loading...
Related Quiz
- Which Python web framework uses the “Don’t repeat yourself” principle?
- For a property named value, the corresponding setter decorator would be _______.
- In which data structure are elements connected using pointers to form a sequence?
- How can you profile a Python script to analyze the time spent in each function call?
- In Python, the ____ keyword is used to define a generator function.