Welcome to the Master Python Repository. This repository is designed as a pedagogical curriculum guiding learners from foundational Python concepts to advanced system engineering, version evolution (Python 2.7 -> Python 3.3 to 3.13), static typing, and high-performance Pythonic code standards.
- Master Curriculum Roadmap
- Python Version Evolution Map (3.3 to 3.13 & Python 2.7 Comparison)
- Version Feature Demonstrations (
python_3_3topython_3_13) - Master Guides & Tutorials (
DOCS/) - Range Sequence Mechanics & Evolution (
range_tutorial/) - Import Documentation & Pythonic Code Standards
- Running Code Examples & Unit Test Suites
| Step | Subject / Module | Description & Focus | Core Concepts Covered | Target Directory |
|---|---|---|---|---|
| 01 | Print & Console I/O | Console output & user input | print(), input(), f-strings, escape sequences |
print_function/ |
| 02 | Numbers & Operators | Numeric types & logic | int, float, complex, arithmetic, bitwise operators |
numbers/, operators/ |
| 03 | Strings & Slicing | Text processing & slicing | Slicing [start:stop:step], urlparse, immutability |
strings/, slicing/ |
| 04 | Control Flow | Decision-making & loops | if/elif/else, for, while, match-case |
if_statements/, match_case/ |
| 05 | Data Structures | Collections & hash maps | Lists, Tuples, Sets, Dictionaries, Comprehensions | lists/, tuples/, sets/, dictionary/ |
| 06 | Functions & Scope | Modular code & LEGB rules | def, *args, **kwargs, lambda, local vs global scope |
functions/, legb_scope/ |
| 07 | Entry Points (__name__) |
Execution context guards | if __name__ == '__main__': main(), CLI args |
name_main/, DOCS/ |
| 08 | Modules & Package I/O | Code organization & files | import, from ... import, CSV, JSON, file I/O |
modules_and_packages/, file_handling_and_io/ |
| 09 | Iterators & Generators | Memory efficiency & lazy loops | iter(), next(), yield, generator expressions |
iterators_and_generators/, yield_generators/ |
| 10 | OOP & Metaprogramming | Object-oriented architecture | Classes, @dataclass, @classmethod, descriptors |
oop/, decorators/ |
| 11 | Type Hints & Testing | Static safety & QA testing | typing module, mypy, pydantic, pytest, unittest |
type_hints/, unittest/, pytest/ |
| 12 | Version Evolution | Feature changes (3.3 - 3.13) | async/await, walrus :=, match/case, free-threaded GIL |
python_3_3/ to python_3_13/ |
| Python Version | Major Language Features & Syntax Additions | Standard Library & Performance Highlights | Python 2.7 Comparison Note |
|---|---|---|---|
| Python 2.7 | Legacy baseline syntax | Eager range() list allocation, print statement |
range() allocated lists; xrange() was a separate generator. |
| Python 3.3 |
yield from (PEP 380), u'str' restoration |
venv module, ipaddress, MappingProxyType
|
Introduced constant range sequence equality. |
| Python 3.4 |
asyncio (PEP 3156), enum (PEP 435) |
pathlib.Path, statistics, functools.singledispatch
|
Unified filesystem path operations via pathlib. |
| Python 3.5 | Native async/await, Generalized Unpacking |
Type Hints (typing), Matrix multiplication operator @
|
Replaced @asyncio.coroutine with native keywords. |
| Python 3.6 | F-strings f"{var}", Variable Annotations |
Numeric underscores 1_000_000, secrets, __init_subclass__
|
Preserved dictionary insertion order by default. |
| Python 3.7 |
@dataclass, breakpoint() built-in |
Postponed evaluation of annotations, contextvars, time.time_ns()
|
Standardized dictionary key ordering in language spec. |
| Python 3.8 | Walrus operator :=, Positional-only /
|
F-string f"{var=}", TypedDict, Protocol, math.prod
|
Vectorcall protocol internal execution speedups. |
| Python 3.9 | Dict Union ` | / |
=, Built-in generics list[str]` |
| Python 3.10 | Pattern Matching match/case (PEP 634) |
Union type operator X | Y, zip(..., strict=True)
|
Simplified type annotations and error tracebacks. |
| Python 3.11 | Faster CPython (10-60% faster runtime) | Exception Groups (except*), tomllib, asyncio.TaskGroup, Self
|
Adaptive bytecode specializing interpreter. |
| Python 3.12 |
type statement & Type parameter lists |
Formalized F-strings (quote reuse/backslashes), @override
|
Per-interpreter GIL support (PEP 684). |
| Python 3.13 | Free-threaded CPython (GIL-free build) | Copy-and-Patch JIT compiler, TypeIs, ReadOnly, PyPy REPL |
Experimental removal of global interpreter lock (PEP 703). |
Each version directory contains a dedicated README.md and runnable demonstration code:
python_3_3/:yield from,ipaddress,venv,MappingProxyType.python_3_4/:pathlib.Path,enum.Enum,singledispatch,statistics.python_3_5/:async/await,typing, generalized unpacking,@operator.python_3_6/: F-strings, numeric underscores1_000_000,secretsmodule.python_3_7/:@dataclass,breakpoint(),contextvars, nanosecond timers.python_3_8/: Walrus operator:=, positional-only/,f"{var=}",TypedDict.python_3_9/: Dict union|, built-in generic annotations (list[int]),zoneinfo.python_3_10/: Structural pattern matching (match/case),X | Yunion types,strictzip.python_3_11/: Faster CPython,tomllib,ExceptionGroup,TaskGroup,typing.Self.python_3_12/: Syntactictypestatement, formalized f-strings,@override.python_3_13/: Free-threaded GIL-free CPython, JIT compiler,TypeIs,ReadOnly.
Check the DOCS/ directory for comprehensive pedagogical guides:
DOCS/__NameMain__Tutorial.md: Definitive master guide coveringif __name__ == '__main__':, script vs module import execution mechanics, CLI argument parsing, local scope bytecode optimization (LOAD_FAST), and version evolution.DOCS/OopTutorial.md: Object-oriented architecture, descriptors, and inheritance patterns.DOCS/UnittestTutorial.md: QA verification and automated test suite design.
The range_tutorial/ directory details the internal mechanics of Python range objects:
-
Python 2.7 vs Python 3.x: Python 2
range()allocated an eagerlistof size$O(N)$ . Python 3rangeis an immutable sequence object with fixed$O(1)$ memory overhead (48 bytes). -
$O(1)$ Containment Testing:val in range(1_000_000)executes using constant-time arithmetic evaluation rather than linear scanning. -
dir(range)Attributes: Demonstrates range sequence properties (start,stop,step) and methods (index(),count(),__contains__).
All code samples adhere strictly to modern Python best practices:
- Import Header Comments: Every script explicitly documents the purpose of imported modules.
- PEP 8 Formatting: Clean 4-space indentation, explicit type hint annotations, and informative docstrings.
- Descriptive Naming: Renamed unclear scripts (e.g.,
slicing/url_slicing.py).
python3 python_3_3/main_3_3.py
python3 python_3_8/main_3_8.py
python3 python_3_12/main_3_12.py# Run pytest unit test suite
pytest tests/
# Run unittest suite in range_tutorial
python3 -m unittest discover -s range_tutorial