Python Classes
Intro to OOP in Python
Learning Outcomes
- What classes are
- The difference between a class and a class instance
- What
self
means and how it's used - The
__init__()
method - Class and instance variables
- Classmethods vs. staticmethods
Theory
Like we've done before, we're going to watch Corey Schafer's Python OOP 6-part series. In this lesson, you'll be introduced to classes and their basic functionality. Watch the following three videos:
- Classes and Instances Video
- Class Variables Video
- Class Methods and Static Methods Video. Warning: this lesson introduces decorators. It's an advanced topic, which we will discuss in future lessons, so don't be stressed out if you don't understand how to use it.
Knowledge Check
- Explain what classes are and how they are used
- What does
self
mean and where is it used? - What does
__init__()
method do? - How to create class vs instance variables, and how to access each?