Python · Lesson 12.3 · Pro
Special methods
Make your objects print nicely, compare, sort and work with len().
In this lesson
- __repr__: how an object prints
- __str__: the friendly version
- __eq__ and __lt__: compare and sort
- __len__ and more
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.