9. Classes and Magic Methods
Python has class. In the world of programming languages, that means the ability to write user-defined types and give them abilities. A class is defined by what it does as much as what it contains. Most modern programming languages have this feature. Python adds a twist. It has something called magic methods, which are automatically called in response to certain circumstances.
Writing classes in Python is extremely simple at first. But it gets interesting quickly.
9.1 Classes and Objects: Basic Syntax
The basic syntax for writing a class in Python is shown here.
class class_name: statements
The statements consist ...