Lesson 33. Customizing classes

After reading lesson 33, you’ll be able to

  • Add special Python methods to your classes
  • Use special operators such as +, -, /, and * on your classes

You’ve been working with classes defined in the Python language since you wrote your first Python program. The most basic type of objects in the Python language, called built-in types, allowed you to use special operators on these types. For example, you used the + operator between two numbers. You were able to use the [] operator to index into a string or a list. You were able to use the print() statement on any of these types of objects, as well as on lists and dictionaries.

Consider this
  • Name five operations you can do between integers.
  • Name one operation ...

Get Get Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.