Keyword yield
In an ordinary function, yield makes calling it create a generator rather than execute the body immediately.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
In an ordinary function, yield makes calling it create a generator rather than execute the body immediately.
The abc module lets you define abstract base classes and mark methods as abstract.
Coordinate asynchronous I/O with an event loop, coroutines and tasks.
Provides specialized containers including Counter, deque and defaultdict.
Build and compose context managers for scoped resources.
Profile a workload by recording call events, counts and elapsed times.
Parse and write delimited text using dialect rules for separators and quoting.
Generate field-based initialization, representation and equality from a class declaration.
Represent dates, times, combined timestamps and durations.
The decimal module provides Decimal for decimal calculations with explicit precision and rounding control, useful for monetary amounts and similar data.
Transform callables with tools for partial application, wrapping and memoization.
Maintain a binary heap in a list for priority-queue operations.
Provides raw, buffered binary and decoded text streams, including in-memory buffers.
Compose iterators for lazy transformations, grouping and combinatorics.
Route severity-tagged records from named loggers through handlers and formatters.
Provides real-number mathematics, including floating-point functions, constants and exact integer operations.
The pstats module analyzes data from cProfile or profile: it sorts function statistics and produces reports that help locate expensive parts of a program.
Compile regular expressions to search, match, extract or replace text.
The sys module exposes interpreter parameters, program arguments, standard streams, and a function that signals program termination.
Benchmark a small statement or callable in repeated batches.
Express static relationships using annotations, unions, generics and protocols, and inspect them at runtime.
Organize test methods in TestCase classes and execute them as suites.
Adds numbers or concatenates compatible sequences.
Extends the list on the left with the elements of the iterable on the right.