Classes

Classes are a way to bundle functionality and state together.

A "type" and a "class" are interchangeable terms in Python: list, dict, tuple, int, str, set, and bool are all classes.

Depending on what you're doing, you might be able to get away with writing quite a bit of Python code without every creating a class.

You'll certainly use quite a few classes in Python (remember types are classes) but you may not need to create your own often.

Classes in Python have quite a few features that are missing from some other programming languages. Python's classes use __dunder__ methods to allow for operator overloading and implementing interfaces ("protocols" as they're usually called in the Python world) such as the iterator protocol, the context manager protocol, or the descriptor protocol.

Class-related screencasts

Class-related articles

Other recommended resources