Video Coming Soon...

Created by Zed A. Shaw Updated 2024-12-10 18:57:40
 

45: Basic Object Oriented Programming

In Exercise 44 you learned how to use a function to create special dict containers with functions attached to them. In this exercise you'll learn the "right" way to do the same thing using Python's class keyword and the Object Oriented Programming (OOP) features.

Object Oriented Programming (OOP) is very complicated to understand and explain, so we'll focus on code to start and slowly build up your understanding of the concept. The most important thing for you to remember when studying this is that OOP is weird. Humans don't think about the world like this, and most of the theory behind OOP has been debunked by modern psychology and neurology. This means that you need to keep grinding OOP code until you get it. It just takes time and exposure, so don't give up.

Python's People

We'll start by reviewing this code that implements the same output, but using Python's official OOP system. Get this code to work and then place it side-by-side with the ex44.py file to compare.

View Source file ex45.py Only

Previous Lesson Next Lesson

Register for Learn Python the Hard Way, 5th Edition (2023-2024)

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.