Dates and Times: datetime, time and calendar
datetime handles calendar dates and clock times, timedelta handles durations, strftime and strptime convert to and from text, and time zones are where...
968 published notes across every category.
datetime handles calendar dates and clock times, timedelta handles durations, strftime and strptime convert to and from text, and time zones are where...
sys is about the running interpreter - arguments, streams, paths and exit. os is about the operating system - environment variables, processes and the...
Six specialised containers that solve problems the built-in types solve awkwardly: counting, grouping, queues, records, and layered lookups.
itertools builds lazy iterators for combining and slicing sequences. functools transforms functions themselves - caching, partial application and redu...
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.