Classes and Objects
A class describes a kind of thing; an object is one of them. Python builds every object the same way, and understanding that removes most of the myste...
Classes and objects, attributes and methods, self and __init__, the four principles, inheritance, super() and the dunder methods.
5 notes
A class describes a kind of thing; an object is one of them. Python builds every object the same way, and understanding that removes most of the myste...
self is the object the method was called on. Python passes it automatically, and every confusing method error traces back to that one mechanism.
Encapsulation, abstraction, inheritance and polymorphism - what each one means in Python specifically, where Python differs from Java or C++, and when...
A subclass gets everything the parent has and can replace any of it. super() calls the parent version, and it is how initialisation chains work.
Dunder methods let your class work with print, len, +, ==, in, iteration and with. They are how Python asks an object to participate in ordinary synta...