Python Object-Oriented Programming

Python Object-Oriented Programming

1h 57mIntermediate2025-01-27

Authors

Joe Marini

Joe Marini

Senior Developer Advocate at Google, Developer

Course details

The object-oriented programming (OOP) features in Python make it easier to build programs of increasing complexity and modularity. In this course with instructor Joe Marini, learn how to apply core OOP principles to build programs that are extensible and efficient. Joe starts with the basics of defining and using classes and objects. Then he moves into more advanced features like abstract base classes and how to implement interfaces. He also details some of the more unique features of Python, like magic class methods to make your classes integrate tightly with the Python language and data classes to dramatically reduce the amount of boilerplate code needed to build data-centric objects.

Skills covered

Object-Oriented ProgrammingPythonProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off

Concepts

Introduction

  • Python object-oriented programming
  • What you should know
  • Setting up the development environment
  • Using CoderPad

Object-Oriented Python

  • Object-oriented programming refresher
  • Basic class definition
  • Instance methods and attributes
  • Checking instance types
  • Class methods and members
  • Solution - Stocks

Inheritance and Composition

  • Understanding inheritance
  • Abstract base classes
  • Using multiple inheritance
  • Interfaces
  • Understanding composition
  • Solution - Stocks and bonds

Magic Object Methods

  • What are magic methods
  • String representation
  • Equality and comparison
  • Attribute access
  • Callable objects
  • Solution - Compare objects

Data Classes

  • Defining a data class
  • Using post initialization
  • Using default values
  • Immutable data classes
  • Solution - Data classes

Conclusion

  • Next steps
40,000 Toman