# trekhleb/learn-python architecture

> Architecture diagram of the GitHub repository trekhleb/learn-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trekhleb/learn-python
- Repository: https://github.com/trekhleb/learn-python

## Overview

This repository is a Python learning playground and cheatsheet, not a conventional runtime application. The learner chooses a documented topic, studies commented examples and assertions, then can modify examples and run them to check behavior. Topic directories organize the material; the README documents the learning and checking workflow. The graph groups related lesson files rather than treating each example as a production service. Source excerpts cover the module examples; other lesson coverage and workflow links are based on the README and tree.

Main entry points: [`src/modules`](https://github.com/trekhleb/learn-python/tree/master/src/modules) (Modules and packages), [`src/operators`](https://github.com/trekhleb/learn-python/tree/master/src/operators) (Operators), [`src/data_types`](https://github.com/trekhleb/learn-python/tree/master/src/data_types) (Data types), [`src/control_flow`](https://github.com/trekhleb/learn-python/tree/master/src/control_flow) (Control flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["Python foundations"]
  node_getting_started["Getting started"]
end

subgraph group_language["Core language"]
  node_operators["Operators"]
  node_data_types["Data types"]
  node_control_flow["Control flow"]
  node_exceptions["Errors and exceptions"]
  node_additions["Generators and pass"]
end

subgraph group_abstraction["Functions and objects"]
  node_functions["Functions"]
  node_classes["Classes"]
end

subgraph group_runtime["Modules and I/O"]
  node_modules["Modules and packages"]
  node_fibonacci["Fibonacci module"]
  node_sound_effects["Sound effects"]
  node_sound_formats["Sound formats"]
  node_files["File handling"]
  node_user_input["Terminal input"]
end

subgraph group_libraries["Standard libraries"]
  node_standard_libraries["Standard library tour"]
end

node_learner(("Learner"))

node_learner -->|"studies"| node_getting_started
node_learner -->|"chooses topic"| node_operators
node_learner -->|"chooses topic"| node_data_types
node_learner -->|"chooses topic"| node_control_flow
node_learner -->|"chooses topic"| node_exceptions
node_learner -->|"chooses topic"| node_functions
node_learner -->|"chooses topic"| node_classes
node_learner -->|"chooses topic"| node_modules
node_learner -->|"chooses topic"| node_files
node_learner -->|"chooses topic"| node_user_input
node_learner -->|"chooses topic"| node_additions
node_learner -->|"chooses topic"| node_standard_libraries
node_modules -->|"demonstrates module"| node_fibonacci
node_modules -->|"demonstrates packages"| node_sound_effects
node_modules -->|"demonstrates packages"| node_sound_formats
node_learner -->|"runs examples"| node_operators
node_learner -->|"runs examples"| node_data_types
node_learner -->|"runs examples"| node_control_flow
node_learner -->|"runs examples"| node_functions
node_learner -->|"runs examples"| node_classes

click node_getting_started "https://github.com/trekhleb/learn-python/tree/master/src/getting_started"
click node_operators "https://github.com/trekhleb/learn-python/tree/master/src/operators"
click node_data_types "https://github.com/trekhleb/learn-python/tree/master/src/data_types"
click node_control_flow "https://github.com/trekhleb/learn-python/tree/master/src/control_flow"
click node_exceptions "https://github.com/trekhleb/learn-python/tree/master/src/exceptions"
click node_functions "https://github.com/trekhleb/learn-python/tree/master/src/functions"
click node_classes "https://github.com/trekhleb/learn-python/tree/master/src/classes"
click node_modules "https://github.com/trekhleb/learn-python/tree/master/src/modules"
click node_fibonacci "https://github.com/trekhleb/learn-python/blob/master/src/modules/fibonacci_module.py"
click node_sound_effects "https://github.com/trekhleb/learn-python/tree/master/src/modules/sound_package/effects"
click node_sound_formats "https://github.com/trekhleb/learn-python/tree/master/src/modules/sound_package/formats"
click node_files "https://github.com/trekhleb/learn-python/tree/master/src/files"
click node_user_input "https://github.com/trekhleb/learn-python/tree/master/src/user_input"
click node_additions "https://github.com/trekhleb/learn-python/tree/master/src/additions"
click node_standard_libraries "https://github.com/trekhleb/learn-python/tree/master/src/standard_libraries"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_getting_started toneBlue
class node_operators,node_data_types,node_control_flow,node_exceptions,node_additions toneAmber
class node_functions,node_classes toneMint
class node_modules,node_fibonacci,node_sound_effects,node_sound_formats,node_files,node_user_input toneRose
class node_standard_libraries,node_learner toneIndigo
```

## Components

### Python foundations

- [Getting started](https://github.com/trekhleb/learn-python/tree/master/src/getting_started): `src/getting_started`

### Core language

- [Operators](https://github.com/trekhleb/learn-python/tree/master/src/operators): `src/operators`
- [Data types](https://github.com/trekhleb/learn-python/tree/master/src/data_types): `src/data_types`
- [Control flow](https://github.com/trekhleb/learn-python/tree/master/src/control_flow): `src/control_flow`
- [Errors and exceptions](https://github.com/trekhleb/learn-python/tree/master/src/exceptions): `src/exceptions`
- [Generators and pass](https://github.com/trekhleb/learn-python/tree/master/src/additions): `src/additions`

### Functions and objects

- [Functions](https://github.com/trekhleb/learn-python/tree/master/src/functions): `src/functions`
- [Classes](https://github.com/trekhleb/learn-python/tree/master/src/classes): `src/classes`

### Modules and I/O

- [Modules and packages](https://github.com/trekhleb/learn-python/tree/master/src/modules): `src/modules`
- [Fibonacci module](https://github.com/trekhleb/learn-python/blob/master/src/modules/fibonacci_module.py): `src/modules/fibonacci_module.py`
- [Sound effects](https://github.com/trekhleb/learn-python/tree/master/src/modules/sound_package/effects): `src/modules/sound_package/effects`
- [Sound formats](https://github.com/trekhleb/learn-python/tree/master/src/modules/sound_package/formats): `src/modules/sound_package/formats`
- [File handling](https://github.com/trekhleb/learn-python/tree/master/src/files): `src/files`
- [Terminal input](https://github.com/trekhleb/learn-python/tree/master/src/user_input): `src/user_input`

### Standard libraries

- [Standard library tour](https://github.com/trekhleb/learn-python/tree/master/src/standard_libraries): `src/standard_libraries`

### Other components

- **Learner**

## Connections

- Learner → Getting started: studies (evidence: `README.md`)
- Learner → Operators: chooses topic (evidence: `README.md`)
- Learner → Data types: chooses topic (evidence: `README.md`)
- Learner → Control flow: chooses topic (evidence: `README.md`)
- Learner → Errors and exceptions: chooses topic (evidence: `README.md`)
- Learner → Functions: chooses topic (evidence: `README.md`)
- Learner → Classes: chooses topic (evidence: `README.md`)
- Learner → Modules and packages: chooses topic (evidence: `README.md`)
- Learner → File handling: chooses topic (evidence: `README.md`)
- Learner → Terminal input: chooses topic (evidence: `README.md`)
- Learner → Generators and pass: chooses topic (evidence: `README.md`)
- Learner → Standard library tour: chooses topic (evidence: `README.md`)
- Modules and packages → Fibonacci module: demonstrates module (evidence: `README.md`)
- Modules and packages → Sound effects: demonstrates packages (evidence: `README.md`)
- Modules and packages → Sound formats: demonstrates packages (evidence: `README.md`)
- Learner → Operators: runs examples (evidence: `README.md`)
- Learner → Data types: runs examples (evidence: `README.md`)
- Learner → Control flow: runs examples (evidence: `README.md`)
- Learner → Functions: runs examples (evidence: `README.md`)
- Learner → Classes: runs examples (evidence: `README.md`)
