Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
190 lines (180 loc) · 10.3 KB
/
Copy pathindex.html
File metadata and controls
190 lines (180 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Primary SEO Metadata -->
<meta name="google-site-verification" content="2o_ihu3I_OUGE3D6O6b0R3JZWT2DIAdr_T01j5aDSGI" />
<title>Python Internals Visualized — Interactive CPython Guide & Memory Simulator</title>
<meta name="title" content="Python Internals Visualized — Interactive CPython Guide & Memory Simulator" />
<meta name="description"
content="Master Python & CPython 3.12 internals with interactive animated diagrams, memory heap simulations, bytecode execution, GIL & asyncio visualizers, and Big-O cheatsheets." />
<meta name="keywords"
content="Python internals, CPython 3.12, Python memory management, Python GIL explained, PyObject internals, Python garbage collection, asyncio event loop, bytecode dis, interactive Python tutorial, Python Big-O complexity" />
<meta name="author" content="Gajanan Patil" />
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<link rel="canonical" href="https://python-internals-visualized.vercel.app/" />
<!-- Favicon & PWA Icons -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/favicon.svg" />
<link rel="manifest" href="/site.webmanifest" />
<meta name="theme-color" content="#18181B" />
<meta name="color-scheme" content="light dark" />
<!-- Open Graph / Facebook / LinkedIn -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://python-internals-visualized.vercel.app/" />
<meta property="og:site_name" content="Python Internals Visualized" />
<meta property="og:title" content="Python Internals Visualized — Interactive CPython Guide & Memory Simulator" />
<meta property="og:description"
content="Explore CPython bytecode, heap memory, PyObjects, garbage collection, closures, the GIL, asyncio, and Big-O with real-time interactive diagrams and practice labs." />
<meta property="og:image" content="https://python-internals-visualized.vercel.app/og-image.svg" />
<meta property="og:image:type" content="image/svg+xml" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="Python Internals Visualized Preview" />
<!-- Twitter / X Cards -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@Gajanan48373486" />
<meta name="twitter:creator" content="@Gajanan48373486" />
<meta name="twitter:title" content="Python Internals Visualized — Interactive CPython Guide & Memory Simulator" />
<meta name="twitter:description"
content="Master Python internals visually: CPython bytecode, PyObjects, garbage collection, closures, GIL, asyncio, and Big-O with interactive diagrams." />
<meta name="twitter:image" content="https://python-internals-visualized.vercel.app/og-image.svg" />
<!-- Preconnect Fonts & Tailwind CDN -->
<script src="https://cdn.tailwindcss.com/3.4.17"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
rel="stylesheet" />
<!-- Structured Data (JSON-LD) for Google Rich Snippets & AI Engines (GEO / AEO) -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebApplication",
"@id": "https://python-internals-visualized.vercel.app/#app",
"name": "Python Internals Visualized",
"url": "https://python-internals-visualized.vercel.app/",
"applicationCategory": "EducationalApplication, DeveloperApplication",
"operatingSystem": "All",
"browserRequirements": "Requires JavaScript. Requires HTML5.",
"description": "Interactive visual studio and simulator for Python CPython 3.12 internals, memory allocation, GIL, asyncio, and Big-O complexity.",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Person",
"name": "Gajanan Patil",
"url": "https://x.com/Gajanan48373486",
"sameAs": [
"https://x.com/Gajanan48373486",
"https://github.com/gajanan0707"
]
}
},
{
"@type": "Course",
"@id": "https://python-internals-visualized.vercel.app/#course",
"name": "Python Internals & CPython 3.12 Architecture",
"description": "Comprehensive visual guide to CPython execution, stack bytecode, memory heaps, generational garbage collection, OOP descriptors, and async concurrency.",
"provider": {
"@type": "Person",
"name": "Gajanan Patil",
"url": "https://x.com/Gajanan48373486"
},
"educationalLevel": "Intermediate to Advanced",
"isAccessibleForFree": true,
"hasCourseInstance": {
"@type": "CourseInstance",
"courseMode": "Online",
"courseWorkload": "PT3H"
}
},
{
"@type": "FAQPage",
"@id": "https://python-internals-visualized.vercel.app/#faq",
"mainEntity": [
{
"@type": "Question",
"name": "How does Python execute source code under the hood?",
"acceptedAnswer": {
"@type": "Answer",
"text": "CPython executes source code in two distinct phases: first, the lexer tokenizes characters and the PEG parser builds an Abstract Syntax Tree (AST) to validate grammar at compile time. The compiler then emits compact stack-based bytecode cached in __pycache__ as .pyc files. Finally, the Python Virtual Machine (PVM) evaluation loop (_PyEval_EvalFrameDefault) executes these opcodes sequentially."
}
},
{
"@type": "Question",
"name": "What is a PyObject in CPython?",
"acceptedAnswer": {
"@type": "Answer",
"text": "In CPython, every value—including integers, strings, functions, and classes—is a heap-allocated C struct called PyObject. Each PyObject carries two fundamental header fields: ob_refcnt (reference count tracking how many names point to it) and ob_type (a pointer to the object's type struct defining its behavior)."
}
},
{
"@type": "Question",
"name": "Why does Python have a Global Interpreter Lock (GIL)?",
"acceptedAnswer": {
"@type": "Answer",
"text": "CPython uses the Global Interpreter Lock (GIL) to prevent race conditions on internal object reference counts (ob_refcnt). Only one operating system thread holds the GIL to execute Python bytecode at any instant. However, blocking I/O system calls and numerical libraries like NumPy release the GIL during heavy operations."
}
},
{
"@type": "Question",
"name": "Why is list.append() O(1) amortized while list.insert(0) is O(n)?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Python lists are implemented as contiguous arrays of PyObject pointers with over-allocation (growing capacity by ~12.5% on resize). Appending places a pointer in pre-allocated empty slots in O(1) amortized time, whereas inserting at index 0 requires shifting every existing item in the array one slot to the right, which takes O(n) linear time."
}
},
{
"@type": "Question",
"name": "How does Python's asyncio event loop achieve concurrency?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Python asyncio uses single-threaded cooperative multitasking. When a coroutine hits an 'await' statement on a non-blocking I/O operation, it suspends execution and yields control back to the event loop. The event loop then resumes other ready tasks, allowing a single thread to handle thousands of concurrent socket connections."
}
}
]
}
]
}
</script>
</head>
<body>
<!-- Semantic Noscript Fallback for Search Bots & AI Crawlers (GEO / LLM indexing) -->
<noscript>
<div style="padding: 24px; font-family: sans-serif; max-width: 800px; margin: auto;">
<h1>Python Internals Visualized</h1>
<p><strong>Interactive visual guide to Python internals, CPython execution, memory management, the GIL, and
asyncio.</strong></p>
<p>Designed by <a href="https://x.com/Gajanan48373486">Gajanan Patil (@Gajanan48373486)</a>.</p>
<h2>Course Modules</h2>
<ul>
<li><strong>01. Execution & Memory:</strong> Lexer, AST Parser, Bytecode, PVM Eval loop, PyObjects,
References, Generational Garbage Collection.</li>
<li><strong>02. Core Data Structures:</strong> Dynamic Lists, Compact Hash Tables, Tuples, Sets, Comprehensions
vs Generators.</li>
<li><strong>03. Functions & Scope:</strong> Call Stack Frames, LEGB Scopes, Closures, Decorators, *args and
**kwargs.</li>
<li><strong>04. Object-Oriented Python:</strong> Instance __dict__, C3 MRO Linearization, super(), Dunder
protocols, Descriptors.</li>
<li><strong>05. Iteration & Laziness:</strong> Iterators, yield generator states, Context Managers (with).
</li>
<li><strong>06. Concurrency & Async:</strong> Global Interpreter Lock (GIL), Threading vs Multiprocessing,
asyncio Event Loop.</li>
<li><strong>07. Typing & Packaging:</strong> Type Hints, sys.path resolution, Virtual Environments.</li>
<li><strong>08. Performance & Internals:</strong> __slots__ memory optimization, lru_cache memoization,
cProfile.</li>
</ul>
<p>Please enable JavaScript in your browser to interact with the animated diagrams, practice lab, and heap
simulator.</p>
</div>
</noscript>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>