Welcome to the ultimate Python reference and learning repository! This project serves as an interactive learning roadmap and code reference guide, tracking your progress from python basics up to system-level advanced topics and ecosystem tooling.
Each file in this repository is a complete, runnable script demonstrating core concepts, syntax, and best practices.
The repository is structured into four progressive learning stages:
graph TD
A[🚀 Stage 1: Basics & Syntax] --> B[⚙️ Stage 2: Intermediate Features]
B --> C[🛠️ Stage 3: Advanced & System-Level]
C --> D[📦 Stage 4: Tooling & Ecosystem]
style A fill:#4B9CD3,stroke:#333,stroke-width:2px,color:#fff
style B fill:#5CB85C,stroke:#333,stroke-width:2px,color:#fff
style C fill:#F0AD4E,stroke:#333,stroke-width:2px,color:#fff
style D fill:#D9534F,stroke:#333,stroke-width:2px,color:#fff
- 🚀 Stage 1: Basic Syntax & Concepts
- ⚙️ Stage 2: Intermediate & Modular Features
- 🛠️ Stage 3: Advanced & System-Level Programming
- 📦 Stage 4: Tooling & Ecosystem References
- 💡 How to Use This Repository
This stage covers the absolute essentials needed to start programming with Python. It covers comments, variables, primitive types, control flow, functions, collections, and basic regex.
| File | Focus / Concept | Core Syntax Preview |
|---|---|---|
| 📄 Basic.py | Console I/O, Python history, pros & cons | print("Hello World")name = input("Enter name: ") |
| 📄 Comment.py | Single-line comments, docstrings (__doc__) |
# comment"""docstring""" |
| 📄 Datatype.py | Primitive types (int, float, str, bool, None) | x: int = 10y: float = 3.14 |
| 📄 Variable.py | Variables, memory references (id()), basic string methods |
x = 10; print(id(x))"name".upper() |
| 📄 Syntax_Variables.py | Assignments, casting, and multi-input packing | a, b = 1, 2num1, num2 = map(int, input().split()) |
| 📄 Operators.py | Math ops, division types, precedence, and Walrus operator | 10 // 3 (floor division)if (n := len(x)) > 3: |
| 📄 Control_Flow.py | conditionals, loops, Ternary, else clause in loops |
val = "A" if cond else "B"for x in range(3): ... else: ... |
| 📄 Functions.py | Functions, *args, **kwargs, lambda functions, recursion |
def f(a, *args, **kwargs): return a |
| 📄 Collections.py | Lists, Tuples, Dictionaries, Sets, slicing & set math | nums[1:4], x, y = y, x (swap)set_a | set_b (union) |
| 📄 Strings.py | String formatting, f-strings formatting | f"{percentage:.2%}"",".join(["a", "b"]) |
| 📄 Regex.py | Regular expressions pattern matching | import rere.findall(r"\d+", "Price 100") |
This stage focuses on intermediate Python programming features, such as building reusable blocks, working with files, error handling, type hinting, and custom contexts.
| File | Focus / Concept | Core Syntax Preview |
|---|---|---|
| 📄 Comprehensions.py | List, Dict, Set comprehensions, generator expressions | squares = [x**2 for x in range(5)]gen = (x**2 for x in range(10)) |
| 📄 Modules_Libraries.py | Standard libraries (math, random, os), custom packages |
import math as m__init__.py module declaration |
| 📄 File_Handling.py | File reading/writing, JSON parsing, modern pathlib usage |
from pathlib import PathPath("t.txt").write_text("Hi") |
| 📄 Exception_Handling.py | Catching multiple exceptions, custom errors, try/except/else/finally |
try: ... except (ValueError, TypeError): |
| 📄 Iterators_Generators_Decorators.py | Iterators (__iter__), generators (yield), decorators, itertools |
yield val@my_decorator wrapping |
| 📄 Closures_Lambdas.py | Closures, scope caching, functional tools (map, filter, reduce) |
def outer(x): return lambda y: x * y |
| 📄 Type_Hints.py | PEP 484 type annotations, Union, Optional, static checkers |
def greet(name: str) -> Optional[str]: |
| 📄 Context_Managers.py | Custom context managers (__enter__/__exit__), @contextmanager |
with custom_resource() as res: |
For deep dives into memory management, OOP structure, multi-threading, asyncio, profiling, and interfacing with C libraries.
| File | Focus / Concept | Core Syntax Preview |
|---|---|---|
| 📄 OOP.py | Classes, multiple inheritance, operator overloading, polymorphism | class Child(Parent1, Parent2):def __add__(self, other): |
| 📄 Metaclasses_Descriptors.py | Custom metaclasses (type), descriptor protocol (__get__/__set__) |
class Meta(type):class Descriptor: |
| 📄 Dataclasses.py | Auto-generated standard class boilerplate, slots usage |
@dataclass(slots=True)history: list = field(default_factory=list) |
| 📄 Async_IO.py | Asynchronous task execution, coroutines, async/await, asyncio |
await asyncio.gather(task1(), task2()) |
| 📄 Multithreading.py | Threading, GIL limits, Locks, Semaphores | import threading; lock = threading.Lock() |
| 📄 Concurrency_Multiprocessing.py | OS Processes, bypassing the GIL, Process Pool mapping | with multiprocessing.Pool() as pool: |
| 📄 C_Extensions.py | Interfacing with C libraries using ctypes and Cython references |
import ctypeslibc = ctypes.CDLL("libc.so.6") |
| 📄 Memory_GIL_313.py | Reference counts (sys.getrefcount), cyclical GC, Python 3.13 free-threaded no-GIL architecture |
import gc; gc.collect() |
This section lists python tools, quality checkers, testing frameworks, configurations, design patterns, and popular package libraries.
| File | Focus / Concept | Core Tools / Frameworks |
|---|---|---|
| 📄 Environments_Packaging.py | Virtual environments, PyPI packaging setup | venv, poetry, uv, pyenv, pyproject.toml |
| 📄 Testing.py | Unit testing, verification strategies, mock testing | pytest, unittest, mocks, test fixtures |
| 📄 Code_Quality.py | Formatters, linters, pre-commit configuration | Black, Ruff, pre-commit |
| 📄 Logging_Debugging.py | Logging configurations, severity levels, line breakpoints | logging, breakpoint() (pdb debugger) |
| 📄 Profiling.py | Time and memory execution diagnostics, bottlenecks | timeit, cProfile, memory profiling |
| 📄 Scripting_Automation.py | Subprocesses, developing terminal commands | subprocess.run(), click, typer |
| 📄 Ecosystem_Frameworks.py | Quick reference for popular Python packages | Web: FastAPI, Django, Flask ORMs: SQLAlchemy Queues: Celery Data/ML: NumPy, Pandas, PyTorch |
| 📄 Design_Patterns.py | Common structural, creational, and behavioral design patterns | Factory pattern, Observer pattern, Singleton pattern |
Ensure you have Python 3.10+ installed. Python 3.13+ is recommended for experimenting with the free-threaded features inside Memory_GIL_313.py.
You can run any script individually in your terminal. For example, to run the Control Flow scripts:
python Control_Flow.pyFor a comprehensive syntax overview mapped directly to these files, please refer to the main repository index cheat sheet:
Happy Coding! 🐍