Python OOP

This Python OOP explains to you the Python object-oriented programming clearly so that you can apply it to develop software more effectively.

By the end of this Python OOP module, you’ll have good knowledge of object-oriented principles. And you’ll know how to use Python syntax to create reliable and robust software applications.

What you’ll learn

  • Create objects in Python by defining classes and methods.
  • Extend classes using inheritance.
  • Understand when to use object-oriented features, and more importantly when not to use them.

Who this tutorial is for

If you’re new to object-oriented programming, or if you have basic Python skills and wish to learn in-depth how and when to correctly apply OOP in Python, this is the tutorial for you.

Section 1. Classes and objects

  • Classes and objects – learn how to define a class and create new objects from the class.
  • __init__() method – show you how to define a constructor for a class by using the __init__() method.
  • Instance & class attributes – understand instance attributes and class attributes, and more importantly when you should use class attributes.
  • Private attributes – learn about private attributes and how to use them effectively.
  • Properties – show you how to use the @property decorate to define properties for a class.
  • Static methods – explain to you static methods and shows you how to use them to group related functions in a class.

Section 2. String Representation of Objects

  • __str__ method – show you how to use the __str__ dunder method to return the string representation of an object.
  • __repr__ method – learn how to use the __repr__ method and the main difference between __str__ and __repr__ methods.

Section 3. Comparing objects

  • __eq__ method – learn how to define the equality logic for comparing objects by values.

Section 4. Inheritance

  • Inheritance – explain to you the inheritance concept and how to define a class that inherits from another class.
  • Abstract classes – show you how to define abstract classes and how to use them to create blueprints for other classes.
Did you find this tutorial helpful ?