enum, copy, pprint, logging and Other Essentials
Five more modules that appear in almost every real program: named constants, safe copying, readable output, proper logging, and identifiers and hashes...
A complete core Python path: syntax, data types, operators, strings, control flow, collections, functions, exceptions, files, modules, the standard library, OOP, iterators, generators, decorators, internals, concurrency, regular expressions, testing, typing, performance, security, problem solving, projects, interview preparation and exams.
110 notes in 33 topics
Five more modules that appear in almost every real program: named constants, safe copying, readable output, proper logging, and identifiers and hashes...
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...
@property turns a method into an attribute. It lets you start with a plain attribute and add validation later without changing a single line of callin...
An instance method receives the object, a class method receives the class, and a static method receives neither. Each exists for a different job.
An abstract base class states what subclasses must implement, and refuses to let an incomplete one be created. It is how Python enforces a contract.
A class can inherit from several parents. The method resolution order decides which version wins, and C3 linearisation is the algorithm that computes...
Inheritance says "is a"; composition says "has a". Most of the time the honest answer is "has a", and the resulting design is easier to change.
An iterable can produce an iterator; an iterator produces one value at a time and remembers where it is. Every for loop in Python is built on those tw...