-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-topic-reference.html
More file actions
1728 lines (1645 loc) · 117 KB
/
Copy pathpython-topic-reference.html
File metadata and controls
1728 lines (1645 loc) · 117 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Python 3.14 Field Guide — Language, Stdlib, Async, Cloud & Fintech, by Topic</title>
<meta name="description" content="An interactive, topic-organized field guide to 150 Python concepts as of Python 3.14 — syntax, built-in types, OOP, functions, the standard library, async, typing and modern syntax — plus production-ready cloud & fintech patterns, with real code examples. Tap any card to learn it." />
<meta name="author" content="Abhaykumar Bhuva" />
<meta name="keywords" content="Python, Python 3.14, free-threaded, t-strings, asyncio, typing, dataclasses, decorators, generators, pattern matching, cloud, fintech, idempotency, Decimal, periodic table alternative" />
<meta name="robots" content="index, follow" />
<meta name="color-scheme" content="dark light" />
<meta id="meta-theme-color" name="theme-color" content="#0a0d12" />
<link rel="canonical" href="https://abhaybhuvagithub.github.io/neuralstack/python-topic-reference.html" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Python Guide" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="NeuralStack" />
<meta property="og:title" content="The Python 3.14 Field Guide — by Topic" />
<meta property="og:description" content="150 Python concepts through Python 3.14 — syntax, types, OOP, stdlib, async, typing and modern syntax, plus production-ready cloud & fintech patterns. Organized by topic, interactive, searchable, free." />
<meta property="og:url" content="https://abhaybhuvagithub.github.io/neuralstack/python-topic-reference.html" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="The Python 3.14 Field Guide — by Topic" />
<meta name="twitter:description" content="150 Python concepts through Python 3.14 — with production-ready cloud & fintech code." />
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='13' fill='%230a0d12'/%3E%3Crect x='7' y='7' width='50' height='50' rx='10' fill='none' stroke='%23ffd043' stroke-width='3'/%3E%3Ctext x='32' y='27' font-family='monospace' font-size='9' fill='%237d8a9c' text-anchor='middle'%3E3.14%3C/text%3E%3Ctext x='32' y='47' font-family='Arial,sans-serif' font-size='20' font-weight='700' fill='%234b8bbe' text-anchor='middle'%3EPy%3C/text%3E%3C/svg%3E" />
<script type="application/ld+json">
{
"@context":"https://schema.org",
"@type":"WebSite",
"name":"The Python 3.14 Field Guide — by Topic",
"url":"https://abhaybhuvagithub.github.io/neuralstack/python-topic-reference.html",
"description":"An interactive, topic-organized field guide to 150 Python concepts as of Python 3.14, with production-ready cloud & fintech code examples.",
"author":{"@type":"Person","name":"Abhaykumar Bhuva","url":"https://www.linkedin.com/in/abhaybhuva/"}
}
</script>
<script>
(function(){try{var t=localStorage.getItem("pytr-theme");if(t!=="light"&&t!=="dark"){t=(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches)?"light":"dark";}document.documentElement.setAttribute("data-theme",t);}catch(e){document.documentElement.setAttribute("data-theme","dark");}})();
</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=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
<style>
:root{
--ink:#0a0d12;--panel:#11161f;--panel-2:#161d28;
--line:rgba(255,255,255,.08);--line-strong:rgba(255,255,255,.16);
--text:#e8edf4;--text-soft:#c4cedb;--muted:#7d8a9c;--muted-2:#566273;
--link:#5aa9e6;--link-hover:#8fc7f0;
--bg-glow-1:rgba(75,139,190,.14);--bg-glow-2:rgba(255,208,67,.08);
--foundations:#4b8bbe;--architecture:#2dd4bf;--training:#ffd043;--language:#6c8cff;
--generative:#ff6fae;--agents:#5fd068;--evaluation:#38bdf8;--systems:#ff8a4c;
--safety:#f6685e;--data:#31c48d;
--display:"Space Grotesk",system-ui,sans-serif;--body:"IBM Plex Sans",system-ui,sans-serif;--mono:"IBM Plex Mono",ui-monospace,monospace;
}
[data-theme="light"]{
--ink:#f5f6f8;--panel:#ffffff;--panel-2:#ffffff;
--line:rgba(12,18,28,.10);--line-strong:rgba(12,18,28,.20);
--text:#141820;--text-soft:#3a4452;--muted:#5a6675;--muted-2:#929cab;
--link:#2f6ea3;--link-hover:#1e4f76;
--bg-glow-1:rgba(47,110,163,.08);--bg-glow-2:rgba(176,116,20,.05);
--foundations:#2f6ea3;--architecture:#0d9488;--training:#b07414;--language:#3b54c9;
--generative:#db2777;--agents:#2f9e44;--evaluation:#0284c7;--systems:#ea580c;
--safety:#dc2626;--data:#0f9d6b;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
background:radial-gradient(1200px 600px at 80% -10%, var(--bg-glow-1), transparent 60%),
radial-gradient(900px 500px at 0% 110%, var(--bg-glow-2), transparent 55%),var(--ink);
color:var(--text);font-family:var(--body);-webkit-font-smoothing:antialiased;
min-height:100vh;line-height:1.5;transition:background-color .3s ease, color .3s ease;
}
.wrap{max-width:1320px;margin:0 auto;padding:clamp(20px,4vw,52px) clamp(14px,3vw,40px) 80px}
.skip-link{position:absolute;left:-9999px;top:8px;z-index:100;background:var(--panel-2);
color:var(--text);border:1px solid var(--line-strong);border-radius:8px;padding:10px 16px;
font-family:var(--mono);font-size:13px;text-decoration:none}
.skip-link:focus{left:12px}
.noscript-msg{margin:24px 0;padding:16px 18px;border:1px solid var(--line-strong);border-radius:12px;
background:var(--panel);color:var(--text-soft);font-size:14px;line-height:1.6}
header{margin-bottom:26px}
.header-top{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:14px}
.header-top .eyebrow{margin-bottom:0}
.eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.32em;text-transform:uppercase;
color:var(--muted);display:flex;align-items:center;gap:10px;margin-bottom:14px}
.eyebrow::before{content:"";width:26px;height:1px;background:var(--line-strong)}
h1{font-family:var(--display);font-weight:600;line-height:1.02;letter-spacing:-.02em;
font-size:clamp(28px,5.4vw,58px);margin:0 0 14px}
h1 .thin{font-weight:300;color:var(--muted)}
.lede{max-width:64ch;color:var(--text-soft);font-size:clamp(14px,1.4vw,16px);font-weight:300}
.meta{margin-top:16px;display:flex;flex-wrap:wrap;gap:18px;align-items:center;
font-family:var(--mono);font-size:12px;color:var(--muted)}
.meta b{color:var(--text);font-weight:500}
.controls{display:flex;flex-wrap:wrap;gap:14px;align-items:center;justify-content:space-between;margin:26px 0 18px}
.search{position:relative;flex:1 1 240px;max-width:340px}
.search input{width:100%;background:var(--panel);border:1px solid var(--line);color:var(--text);
font-family:var(--mono);font-size:13px;padding:11px 14px 11px 38px;border-radius:10px;outline:none;
transition:border-color .18s ease, box-shadow .18s ease}
.search input::placeholder{color:var(--muted-2)}
.search input:focus{border-color:var(--line-strong);box-shadow:0 0 0 3px rgba(75,139,190,.18)}
.search svg{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:var(--muted-2)}
.legend{display:flex;flex-wrap:wrap;gap:7px}
.chip{appearance:none;border:1px solid var(--line);background:var(--panel);color:var(--muted);
font-family:var(--mono);font-size:11px;letter-spacing:.02em;padding:6px 11px;border-radius:999px;
cursor:pointer;display:inline-flex;align-items:center;gap:7px;transition:all .16s ease}
.chip .dot{width:9px;height:9px;border-radius:50%;background:var(--c);box-shadow:0 0 8px -1px var(--c)}
.chip:hover{color:var(--text);border-color:var(--line-strong)}
.chip.active{color:#0a0d12;background:var(--c);border-color:var(--c);font-weight:500}
.chip.active .dot{background:#0a0d12;box-shadow:none}
[data-theme="light"] .chip.active{color:#fff}
[data-theme="light"] .chip.active .dot{background:#fff}
.theme-toggle{appearance:none;display:inline-flex;align-items:center;gap:8px;
border:1px solid var(--line);background:var(--panel);color:var(--text);
font-family:var(--mono);font-size:12px;padding:9px 14px;border-radius:999px;cursor:pointer;
transition:border-color .16s ease,background-color .16s ease,color .16s ease}
.theme-toggle:hover{border-color:var(--line-strong)}
.theme-toggle:focus-visible{outline:2px solid var(--link);outline-offset:2px}
.theme-toggle .tt-ico{width:15px;height:15px;display:inline-block}
.theme-toggle .tt-ico .sun{display:none}.theme-toggle .tt-ico .moon{display:inline}
[data-theme="light"] .theme-toggle .tt-ico .sun{display:inline}
[data-theme="light"] .theme-toggle .tt-ico .moon{display:none}
.scroller{overflow-x:auto;overflow-y:hidden;padding:6px 2px 10px;margin:0 -2px;
-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;scrollbar-color:var(--line-strong) transparent}
.scroller::-webkit-scrollbar{height:9px}
.scroller::-webkit-scrollbar-thumb{background:var(--line-strong);border-radius:9px}
.table{display:grid;grid-template-columns:repeat(18,minmax(0,1fr));grid-auto-rows:auto;gap:clamp(3px,.5vw,6px);min-width:880px}
.cell{--c:#4b8bbe;position:relative;aspect-ratio:1/1;border:1px solid var(--line);
background:linear-gradient(160deg, color-mix(in srgb, var(--c) 13%, var(--panel)) 0%, var(--panel) 78%);
border-radius:7px;padding:5px 5px 4px;cursor:pointer;text-align:left;color:var(--text);
display:flex;flex-direction:column;justify-content:space-between;overflow:hidden;
transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .2s ease;font-family:var(--body)}
.cell::before{content:"";position:absolute;inset:0 0 auto 0;height:2px;background:var(--c);opacity:.7}
.cell .num{font-family:var(--mono);font-size:9px;color:var(--muted);line-height:1}
.cell .sym{font-family:var(--display);font-weight:600;color:var(--c);
font-size:clamp(13px,1.7vw,21px);line-height:1;letter-spacing:-.01em;margin-top:auto}
.cell .name{font-size:8px;line-height:1.12;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;
-webkit-box-orient:vertical;margin-top:3px;min-height:0;color:var(--muted)}
.cell:hover{transform:translateY(-3px);border-color:color-mix(in srgb,var(--c) 55%,transparent);
box-shadow:0 10px 26px -14px var(--c),0 0 0 1px color-mix(in srgb,var(--c) 35%,transparent) inset;z-index:3}
.cell:focus-visible{outline:2px solid var(--c);outline-offset:2px;z-index:4}
.cell.dim{opacity:.14;filter:saturate(.35)}
.cell.in-cat{opacity:1;filter:none;outline:2px dashed var(--c);outline-offset:3px;
box-shadow:0 0 0 1px color-mix(in srgb,var(--c) 30%,transparent) inset,0 8px 22px -14px var(--c);z-index:2}
.cell.selected{transform:translateY(-3px);box-shadow:0 0 0 2px var(--c),0 14px 30px -14px var(--c);border-color:var(--c);z-index:4}
.marker{aspect-ratio:1/1;border:1px dashed var(--line-strong);border-radius:7px;display:flex;align-items:center;justify-content:center;
font-family:var(--mono);font-size:clamp(11px,1.5vw,16px);color:var(--muted);background:transparent}
.series-gap{grid-column:1 / -1;height:26px;display:flex;align-items:flex-end;padding-left:2px}
.series-gap span{font-family:var(--mono);font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted-2)}
.scrim{position:fixed;inset:0;background:rgba(5,7,10,.55);backdrop-filter:blur(2px);
opacity:0;pointer-events:none;transition:opacity .25s ease;z-index:40}
.scrim.show{opacity:1;pointer-events:auto}
.detail{--c:#4b8bbe;position:fixed;z-index:50;right:24px;top:24px;width:min(400px,calc(100vw - 32px));
background:var(--panel-2);border:1px solid var(--line-strong);border-radius:16px;
padding:24px;box-shadow:0 30px 70px -30px rgba(0,0,0,.8);max-height:calc(100vh - 48px);overflow:auto;
transform:translateY(-12px) scale(.98);opacity:0;pointer-events:none;
transition:transform .26s cubic-bezier(.2,.8,.2,1), opacity .22s ease}
.detail.show{transform:none;opacity:1;pointer-events:auto}
.detail::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;border-radius:16px 16px 0 0;background:var(--c)}
.detail .close{position:absolute;top:16px;right:16px;width:30px;height:30px;border-radius:8px;
border:1px solid var(--line);background:transparent;color:var(--muted);cursor:pointer;
font-size:16px;line-height:1;display:flex;align-items:center;justify-content:center;transition:all .15s ease}
.detail .close:hover{color:var(--text);border-color:var(--line-strong)}
.detail .d-top{display:flex;align-items:baseline;gap:14px;margin-bottom:6px}
.detail .d-num{font-family:var(--mono);font-size:12px;color:var(--muted)}
.detail .d-sym{font-family:var(--display);font-weight:700;font-size:46px;line-height:1;color:var(--c);letter-spacing:-.02em}
.detail .d-name{font-family:var(--display);font-weight:500;font-size:20px;margin:10px 0 14px}
.detail .d-cat{display:inline-flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11px;
color:var(--c);border:1px solid color-mix(in srgb,var(--c) 40%,transparent);
padding:4px 10px;border-radius:999px;margin-bottom:16px;letter-spacing:.04em}
.detail .d-cat .dot{width:8px;height:8px;border-radius:50%;background:var(--c)}
.detail .d-desc{color:var(--text-soft);font-size:14.5px;font-weight:300;line-height:1.62}
.byline{margin-top:14px;font-size:13px;color:var(--muted);font-weight:300}
a.ln{color:var(--link);text-decoration:none;font-weight:500;border-bottom:1px solid transparent;transition:border-color .15s ease,color .15s ease}
a.ln:hover{color:var(--link-hover);border-bottom-color:currentColor}
.visitors b{color:var(--text)}
footer{margin-top:42px;border-top:1px solid var(--line);padding-top:20px;
font-family:var(--mono);font-size:11px;color:var(--muted-2);line-height:1.7;max-width:74ch}
.foot-line{margin-bottom:6px}.foot-line b{color:var(--text)}
.foot-byline{margin-top:12px;font-family:var(--body);font-size:13px;color:var(--muted)}
.knowledge{--c:var(--training);position:relative;display:flex;gap:16px 24px;align-items:center;justify-content:space-between;flex-wrap:wrap;
margin:24px 0 2px;padding:18px 20px 18px 22px;border:1px solid var(--line);border-radius:14px;overflow:hidden;
background:linear-gradient(150deg,color-mix(in srgb,var(--c) 10%,var(--panel)),var(--panel) 72%)}
.knowledge::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--c)}
.kn-main{flex:1 1 360px;min-width:0}
.kn-eyebrow{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11px;
letter-spacing:.2em;text-transform:uppercase;color:var(--c);margin-bottom:9px}
.kn-eyebrow svg{width:14px;height:14px}
.kn-fact{margin:0;font-size:15px;line-height:1.6;color:var(--text-soft);font-weight:300}
.kn-fact b{color:var(--text);font-weight:500}
.kn-actions{display:flex;align-items:center;gap:16px;flex-shrink:0}
.kn-jump{font-family:var(--mono);font-size:12px;color:var(--c);text-decoration:none;
border-bottom:1px solid transparent;transition:border-color .15s ease;white-space:nowrap}
.kn-jump:hover{border-bottom-color:currentColor}.kn-jump[hidden]{display:none}
.kn-btn{appearance:none;display:inline-flex;align-items:center;gap:8px;border:1px solid var(--c);
background:transparent;color:var(--c);font-family:var(--mono);font-size:12.5px;font-weight:500;
padding:10px 16px;border-radius:999px;cursor:pointer;white-space:nowrap;
transition:background-color .16s ease,color .16s ease;touch-action:manipulation}
.kn-btn:hover{background:var(--c);color:var(--ink)}
.kn-btn:focus-visible{outline:2px solid var(--c);outline-offset:2px}
.kn-fade{animation:knfade .35s ease}
@keyframes knfade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.scroll-hint{display:none;align-items:center;gap:8px;margin:0 0 8px;font-family:var(--mono);font-size:11px;color:var(--muted);letter-spacing:.04em}
.scroll-hint svg{animation:nudge 1.6s ease-in-out infinite}
@keyframes nudge{0%,100%{transform:translateX(0)}50%{transform:translateX(4px)}}
@media (hover:none){.cell:active{transform:translateY(-2px)}}
.cell,.chip,.theme-toggle,.close,.search input,.skip-link{touch-action:manipulation}
@media (max-width:760px){.scroll-hint{display:flex}}
@media (max-width:640px){
.wrap{padding-top:18px}.header-top{margin-bottom:12px}.meta{gap:12px;font-size:11px}
.detail{right:0;left:0;bottom:0;top:auto;width:100%;border-radius:18px 18px 0 0;
transform:translateY(16px);max-height:82vh;overflow:auto;padding-top:30px}
.detail.show{transform:none}
.detail::after{content:"";position:absolute;top:9px;left:50%;transform:translateX(-50%);width:42px;height:4px;border-radius:4px;background:var(--line-strong)}
.controls{flex-direction:column;align-items:stretch;gap:12px}.search{max-width:none}
.search input{padding-top:13px;padding-bottom:13px}.legend{gap:8px}.chip{padding:9px 13px;font-size:12px}
.theme-toggle{align-self:flex-start;padding:11px 16px}
.knowledge{flex-direction:column;align-items:stretch;gap:14px}.kn-actions{justify-content:space-between}.kn-btn{flex:0 0 auto}
.table{min-width:760px}.cell .name{font-size:7.5px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
@keyframes pop{from{opacity:0;transform:translateY(8px) scale(.96)}to{opacity:1;transform:none}}
.anim .cell{animation:pop .5s both;animation-delay:calc(var(--i,0)*5ms)}
@media print{
:root{--ink:#fff;--panel:#fff;--panel-2:#fff;--text:#000;--text-soft:#222;--muted:#444;--muted-2:#666;--line:#ccc;--line-strong:#999}
body{background:#fff;color:#000}.controls,.theme-toggle,.scrim,.detail,.skip-link,.search{display:none!important}
.scroller{overflow:visible}.table{min-width:0}
.cell{break-inside:avoid;box-shadow:none!important;transform:none!important}.cell::before{opacity:1}a.ln{color:#000}
}
.tod{display:inline-flex;align-items:center;gap:6px}
.tod a{color:var(--link);text-decoration:none;border-bottom:1px solid transparent;font-weight:500}
.tod a:hover{border-bottom-color:currentColor}
.toolbar{display:flex;flex-direction:column;gap:14px;margin:26px 0 18px}
.tb-row{display:flex;flex-wrap:wrap;gap:14px;align-items:center;justify-content:space-between}
.tb-filters{gap:18px}
.pill-btn{appearance:none;display:inline-flex;align-items:center;gap:8px;border:1px solid var(--c,var(--foundations));
background:transparent;color:var(--c,var(--foundations));font-family:var(--mono);font-size:12.5px;font-weight:500;
padding:10px 16px;border-radius:999px;cursor:pointer;white-space:nowrap;transition:background-color .16s ease,color .16s ease;touch-action:manipulation}
.pill-btn:hover{background:var(--c,var(--foundations));color:var(--ink)}
.pill-btn:focus-visible{outline:2px solid var(--c,var(--foundations));outline-offset:2px}
.pill-btn svg{width:14px;height:14px}
.quiz-launch{--c:var(--agents)}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--panel)}
.seg-btn{appearance:none;background:transparent;border:0;color:var(--muted);font-family:var(--mono);font-size:12px;
padding:9px 14px;cursor:pointer;transition:background-color .15s ease,color .15s ease;touch-action:manipulation}
.seg-btn+.seg-btn{border-left:1px solid var(--line)}
.seg-btn:hover{color:var(--text)}
.seg-btn.active{background:color-mix(in srgb,var(--foundations) 16%,var(--panel));color:var(--text)}
.seg-btn:focus-visible{outline:2px solid var(--foundations);outline-offset:-2px}
.levelfilter{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.lf-label{font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted-2)}
.lchip{appearance:none;border:1px solid var(--line);background:var(--panel);color:var(--muted);
font-family:var(--mono);font-size:11px;padding:6px 11px;border-radius:999px;cursor:pointer;transition:all .15s ease;touch-action:manipulation}
.lchip:hover{color:var(--text);border-color:var(--line-strong)}
.lchip.active{background:var(--text);color:var(--ink);border-color:var(--text);font-weight:500}
.progress{display:flex;align-items:center;gap:10px;min-width:180px}
.pbar{flex:1;height:6px;border-radius:6px;background:var(--line);overflow:hidden;min-width:90px}
.pbar-fill{height:100%;width:0;border-radius:6px;background:var(--agents);transition:width .35s ease}
.pcount{font-family:var(--mono);font-size:11px;color:var(--muted);white-space:nowrap}
.cell .check{position:absolute;top:3px;right:4px;width:11px;height:11px;border-radius:50%;
background:var(--agents);color:var(--ink);font-size:8px;line-height:11px;text-align:center;
opacity:0;transform:scale(.5);transition:opacity .15s ease,transform .15s ease}
.cell.learned .check{opacity:1;transform:none}
#tooltip{--c:var(--foundations);position:fixed;z-index:60;max-width:248px;pointer-events:none;
background:var(--panel-2);border:1px solid var(--line-strong);border-left:3px solid var(--c);
border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.45;color:var(--text-soft);
box-shadow:0 14px 34px -18px rgba(0,0,0,.8);opacity:0;transform:translate(-50%,-100%) translateY(-4px);transition:opacity .12s ease}
#tooltip.show{opacity:1}#tooltip.below{transform:translate(-50%,0) translateY(4px)}
#tooltip b{display:block;color:var(--c);font-family:var(--display);font-weight:600;font-size:13px;margin-bottom:3px}
.view{margin-top:6px}
.lv-group{margin-bottom:26px}
.lv-h{font-family:var(--mono);font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);
margin:0 0 12px;padding-bottom:8px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:12px}
.lv-h .lv-count{color:var(--muted-2)}
.lv-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:8px}
.lv-item{--c:var(--foundations);display:flex;align-items:center;gap:12px;text-align:left;
border:1px solid var(--line);border-left:3px solid var(--c);border-radius:10px;padding:10px 12px;
background:var(--panel);cursor:pointer;color:var(--text);transition:border-color .15s ease,transform .15s ease;
font-family:var(--body);width:100%;min-width:0}
.lv-item:hover{transform:translateX(2px);border-color:color-mix(in srgb,var(--c) 45%,transparent)}
.lv-item:focus-visible{outline:2px solid var(--c);outline-offset:2px}
.lv-sym{font-family:var(--display);font-weight:600;color:var(--c);font-size:17px;min-width:30px}
.lv-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.lv-name{font-size:13.5px;font-weight:500;display:flex;align-items:center;gap:7px}
.lv-name .lv-yr{font-family:var(--mono);font-size:10px;color:var(--muted-2);font-weight:400}
.lv-desc{display:block;max-width:100%;font-size:11.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lv-item .check{margin-left:auto;color:var(--agents);font-size:12px;opacity:0}
.lv-item.learned .check{opacity:1}
.lv-item[hidden]{display:none!important}
.lv-group[hidden]{display:none!important}
#view-timeline .tl-note{font-family:var(--mono);font-size:11px;color:var(--muted-2);margin:0 0 18px;line-height:1.5}
#view-timeline .lv-group{position:relative;padding-left:24px;margin-bottom:20px;border-left:2px solid var(--line)}
#view-timeline .lv-group::before{content:"";position:absolute;left:-7px;top:3px;width:11px;height:11px;
border-radius:50%;background:var(--foundations);box-shadow:0 0 0 3px var(--ink)}
#view-timeline .lv-h{color:var(--foundations);font-size:13px}
.totd{display:inline-flex;align-items:center;gap:11px;margin:16px 0 0;padding:9px 15px;border:1px solid var(--line);
border-radius:999px;background:var(--panel);cursor:pointer;font-family:var(--body);color:var(--text);
transition:border-color .15s ease;touch-action:manipulation;max-width:100%}
.totd[hidden]{display:none}.totd:hover{border-color:var(--line-strong)}
.totd-k{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted-2);white-space:nowrap}
.totd-sym{font-family:var(--display);font-weight:600;color:var(--foundations)}
.totd-name{font-size:13px;color:var(--text-soft);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.totd-go{color:var(--muted);font-family:var(--mono);margin-left:2px}
.quiz-overlay{position:fixed;inset:0;z-index:70;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(5,7,10,.6);backdrop-filter:blur(3px)}
.quiz-overlay[hidden]{display:none}
.quiz-card{--c:var(--agents);position:relative;width:min(520px,100%);background:var(--panel-2);
border:1px solid var(--line-strong);border-radius:18px;padding:26px 24px 22px;box-shadow:0 40px 90px -40px rgba(0,0,0,.85)}
.quiz-card::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;border-radius:18px 18px 0 0;background:var(--c)}
.quiz-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:14px}
.quiz-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.22em;text-transform:uppercase;color:var(--c)}
.quiz-score{font-family:var(--mono);font-size:12px;color:var(--muted)}
.quiz-q{font-size:15px;line-height:1.55;color:var(--text-soft);margin:0 0 18px}
.quiz-opts{display:flex;flex-direction:column;gap:9px}
.quiz-opt{appearance:none;text-align:left;border:1px solid var(--line);background:var(--panel);color:var(--text);
font-family:var(--body);font-size:14px;padding:12px 14px;border-radius:10px;cursor:pointer;
transition:border-color .15s ease,background-color .15s ease;touch-action:manipulation}
.quiz-opt:hover:not(:disabled){border-color:var(--line-strong)}.quiz-opt:disabled{cursor:default}
.quiz-opt.correct{border-color:var(--agents);background:color-mix(in srgb,var(--agents) 16%,var(--panel))}
.quiz-opt.wrong{border-color:var(--safety);background:color-mix(in srgb,var(--safety) 14%,var(--panel))}
.quiz-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:16px;min-height:34px}
.quiz-feedback{font-size:13px;color:var(--muted)}
.quiz-feedback.ok{color:var(--agents)}.quiz-feedback.no{color:var(--safety)}
.d-label{display:block;font-family:var(--mono);font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted-2);margin-bottom:6px}
.d-example{margin-top:16px;padding:12px 14px;border-radius:10px;background:var(--panel);border:1px solid var(--line);font-size:12.5px;line-height:1.5;color:var(--text-soft)}
.d-example pre{margin:0;font-family:var(--mono);white-space:pre-wrap;word-break:break-word}
.d-prod{margin-top:14px;padding:12px 14px;border-radius:10px;border:1px solid color-mix(in srgb,var(--data) 40%,transparent);
background:color-mix(in srgb,var(--data) 8%,var(--panel))}
.d-prod .d-label{color:var(--data)}
.d-prod pre{margin:0;font-family:var(--mono);font-size:12px;line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--text-soft)}
.d-debug,.d-test,.d-live{margin-top:14px;padding:12px 14px;border-radius:10px}
.d-debug{border:1px solid color-mix(in srgb,var(--training) 40%,transparent);background:color-mix(in srgb,var(--training) 8%,var(--panel))}
.d-debug .d-label{color:var(--training)}
.d-test{border:1px solid color-mix(in srgb,var(--agents) 40%,transparent);background:color-mix(in srgb,var(--agents) 8%,var(--panel))}
.d-test .d-label{color:var(--agents)}
.d-live{border:1px solid color-mix(in srgb,var(--evaluation) 45%,transparent);background:color-mix(in srgb,var(--evaluation) 9%,var(--panel))}
.d-live .d-label{color:var(--evaluation)}
.d-debug pre,.d-test pre,.d-live pre{margin:0;font-family:var(--mono);font-size:12px;line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--text-soft)}
.d-related{margin-top:16px}
.d-related-chips{display:flex;flex-wrap:wrap;gap:7px}
.r-chip{appearance:none;border:1px solid color-mix(in srgb,var(--c) 40%,transparent);background:transparent;
color:var(--c);font-family:var(--mono);font-size:11.5px;padding:5px 10px;border-radius:999px;cursor:pointer;transition:background-color .15s ease,color .15s ease}
.r-chip:hover{background:var(--c);color:var(--ink)}
.d-actions{margin-top:20px;padding-top:16px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:12px}
.d-learn{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;
border:1px solid var(--c);background:transparent;color:var(--c);font-family:var(--mono);font-size:12.5px;
font-weight:500;padding:10px 14px;border-radius:10px;cursor:pointer;transition:all .15s ease;touch-action:manipulation}
.d-learn:hover{background:color-mix(in srgb,var(--c) 14%,transparent)}.d-learn.on{background:var(--c);color:var(--ink)}
.d-links{display:flex;gap:8px;flex-wrap:wrap}
.d-link{appearance:none;border:1px solid var(--line);background:transparent;color:var(--muted);
font-family:var(--mono);font-size:11.5px;padding:7px 12px;border-radius:8px;cursor:pointer;text-decoration:none;transition:all .15s ease;touch-action:manipulation}
.d-link:hover{color:var(--text);border-color:var(--line-strong)}.d-link.copied{color:var(--agents);border-color:var(--agents)}
@media (max-width:640px){.tb-row{flex-direction:column;align-items:stretch}.seg{width:100%}.seg-btn{flex:1}.progress{min-width:0}.lv-items{grid-template-columns:1fr}}
.menu-fab{appearance:none;flex:0 0 auto;width:38px;height:38px;border-radius:10px;border:1px solid var(--line);background:var(--panel);color:var(--text);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:border-color .16s ease,background-color .16s ease;touch-action:manipulation}
.menu-fab:hover{border-color:var(--line-strong)}
.menu-fab:focus-visible{outline:2px solid var(--link);outline-offset:2px}
.menu-fab svg{width:19px;height:19px}
.header-top .eyebrow{margin-right:auto}
.tmenu-scrim{position:fixed;inset:0;background:rgba(5,7,10,.5);backdrop-filter:blur(2px);opacity:0;pointer-events:none;transition:opacity .25s ease;z-index:75}
.tmenu-scrim.show{opacity:1;pointer-events:auto}
.tmenu{position:fixed;top:0;left:0;bottom:0;width:min(300px,86vw);z-index:76;background:var(--panel-2);border-right:1px solid var(--line-strong);box-shadow:0 0 60px -20px rgba(0,0,0,.8);padding:22px 16px;overflow-y:auto;transform:translateX(-104%);transition:transform .28s cubic-bezier(.2,.8,.2,1)}
.tmenu.show{transform:none}
.tmenu-head{font-family:var(--mono);font-size:11px;letter-spacing:.2em;text-transform:uppercase;color:var(--muted);margin:2px 4px 14px}
.tmenu-item{appearance:none;display:flex;align-items:center;gap:11px;width:100%;text-align:left;border:1px solid transparent;border-radius:10px;padding:11px 12px;background:transparent;color:var(--text);font-family:var(--body);font-size:14px;cursor:pointer;transition:background-color .15s ease,border-color .15s ease;touch-action:manipulation}
.tmenu-item:hover{background:color-mix(in srgb,var(--c,var(--link)) 12%,transparent);border-color:color-mix(in srgb,var(--c,var(--link)) 35%,transparent)}
.tmenu-item:focus-visible{outline:2px solid var(--c,var(--link));outline-offset:-2px}
.tmenu-item .tmenu-dot{width:10px;height:10px;border-radius:50%;background:var(--c,var(--link));flex:0 0 auto;box-shadow:0 0 8px -1px var(--c,var(--link))}
.tmenu-item .tmenu-label{flex:1;min-width:0}
.tmenu-item .tmenu-count{font-family:var(--mono);font-size:11px;color:var(--muted-2)}
.tmenu-all{justify-content:center;color:var(--muted);border:1px solid var(--line);margin-bottom:10px;font-family:var(--mono);font-size:12px}
.tmenu-all:hover{color:var(--text);border-color:var(--line-strong);background:transparent}
@media print{.menu-fab,.tmenu,.tmenu-scrim{display:none!important}}
.asst-fab{position:fixed;right:20px;bottom:20px;z-index:80;width:56px;height:56px;border-radius:50%;
border:none;background:var(--foundations);color:var(--ink);cursor:pointer;display:flex;align-items:center;justify-content:center;
box-shadow:0 12px 30px -10px var(--foundations),0 4px 10px -4px rgba(0,0,0,.5);transition:transform .18s ease, box-shadow .18s ease}
.asst-fab:hover{transform:translateY(-2px) scale(1.04)}
.asst-fab:focus-visible{outline:2px solid var(--link);outline-offset:3px}
.asst-fab svg{width:26px;height:26px}
[data-theme="light"] .asst-fab{color:#fff}
.asst-fab .asst-badge{position:absolute;top:-3px;right:-3px;width:14px;height:14px;border-radius:50%;
background:var(--generative);border:2px solid var(--ink)}
.asst-panel{position:fixed;right:20px;bottom:88px;z-index:82;width:min(370px,calc(100vw - 32px));
height:min(560px,calc(100vh - 130px));display:flex;flex-direction:column;
background:var(--panel-2);border:1px solid var(--line-strong);border-radius:16px;overflow:hidden;
box-shadow:0 30px 70px -24px rgba(0,0,0,.8);transform:translateY(14px) scale(.98);opacity:0;pointer-events:none;
transition:transform .24s cubic-bezier(.2,.8,.2,1),opacity .2s ease}
.asst-panel.open{transform:none;opacity:1;pointer-events:auto}
.asst-panel::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;background:var(--foundations)}
.asst-head{display:flex;align-items:center;gap:10px;padding:14px 14px 12px;border-bottom:1px solid var(--line)}
.asst-avatar{width:30px;height:30px;border-radius:9px;background:color-mix(in srgb,var(--foundations) 22%,var(--panel));
color:var(--foundations);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.asst-avatar svg{width:17px;height:17px}
.asst-title{flex:1;min-width:0}
.asst-title b{display:block;font-family:var(--display);font-size:14px;font-weight:600;color:var(--text)}
.asst-title span{font-family:var(--mono);font-size:10px;letter-spacing:.06em;color:var(--muted)}
.asst-close{width:28px;height:28px;border-radius:8px;border:1px solid var(--line);background:transparent;color:var(--muted);
cursor:pointer;font-size:15px;line-height:1;display:flex;align-items:center;justify-content:center}
.asst-close:hover{color:var(--text);border-color:var(--line-strong)}
.asst-log{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px;scrollbar-color:var(--line-strong) transparent}
.asst-log::-webkit-scrollbar{width:8px}.asst-log::-webkit-scrollbar-thumb{background:var(--line-strong);border-radius:8px}
.asst-msg{max-width:88%;font-size:13px;line-height:1.5;padding:9px 12px;border-radius:12px;word-break:break-word}
.asst-msg.bot{align-self:flex-start;background:var(--panel);border:1px solid var(--line);color:var(--text-soft);border-bottom-left-radius:4px}
.asst-msg.me{align-self:flex-end;background:color-mix(in srgb,var(--foundations) 20%,var(--panel));
border:1px solid color-mix(in srgb,var(--foundations) 45%,transparent);color:var(--text);border-bottom-right-radius:4px}
.asst-msg b{color:var(--text);font-weight:600}
.asst-msg pre{margin:8px 0 2px;font-family:var(--mono);font-size:11.5px;white-space:pre-wrap;word-break:break-word;
background:var(--ink);border:1px solid var(--line);border-radius:8px;padding:8px 10px;color:var(--text-soft);max-height:180px;overflow:auto}
.asst-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.asst-chip{appearance:none;border:1px solid color-mix(in srgb,var(--foundations) 40%,transparent);background:transparent;
color:var(--foundations);font-family:var(--mono);font-size:11px;padding:5px 10px;border-radius:999px;cursor:pointer;
transition:background-color .14s ease,color .14s ease}
.asst-chip:hover{background:var(--foundations);color:var(--ink)}
[data-theme="light"] .asst-chip:hover{color:#fff}
.asst-foot{display:flex;gap:8px;padding:10px 12px;border-top:1px solid var(--line);align-items:center}
.asst-input{flex:1;background:var(--panel);border:1px solid var(--line);color:var(--text);font-family:var(--body);
font-size:13px;padding:10px 12px;border-radius:10px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}
.asst-input:focus{border-color:var(--line-strong);box-shadow:0 0 0 3px color-mix(in srgb,var(--foundations) 16%,transparent)}
.asst-send{width:38px;height:38px;flex:0 0 auto;border-radius:10px;border:none;background:var(--foundations);color:var(--ink);
cursor:pointer;display:flex;align-items:center;justify-content:center}
.asst-send:hover{filter:brightness(1.08)}[data-theme="light"] .asst-send{color:#fff}
.asst-send svg{width:17px;height:17px}
@media (max-width:640px){.asst-panel{right:12px;left:12px;width:auto;bottom:82px;height:min(70vh,520px)}.asst-fab{right:14px;bottom:14px}}
@media print{.asst-fab,.asst-panel{display:none!important}}
</style>
</head>
<body>
<a class="skip-link" href="#view-topics">Skip to the topics</a>
<div class="wrap">
<header>
<div class="header-top">
<button class="menu-fab" id="menu-fab" type="button" aria-label="Open topics menu" aria-expanded="false" title="Browse topics">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
</button>
<div class="eyebrow">A field guide · 150 terms · by topic</div>
<button class="theme-toggle" id="theme-toggle" aria-label="Switch color theme" aria-pressed="false" title="Switch color theme">
<span class="tt-ico" aria-hidden="true">
<svg class="moon" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
<svg class="sun" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4.2"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
</span>
<span class="tt-label" id="tt-label">Light</span>
</button>
</div>
<h1>The <span class="thin">Python 3.14</span> Field Guide</h1>
<p class="lede">150 building blocks of Python as of Python 3.14 — organized <b>by topic</b>, not as a grid — from syntax and built-in types to OOP, functions, the standard library, async and modern typing, plus a dedicated topic of production-ready <b>cloud & fintech</b> patterns. Each card carries a plain-language definition, a code example, and where it matters, a production-grade snippet. Tap any card to dig in.</p>
<div class="meta">
<span><b id="count">150</b> terms</span>
<span><b>10</b> topics</span>
<span class="visitors" aria-live="polite"><b id="visitors-top">…</b> visitors</span>
<span class="tod">Term of the day: <a id="tod-link" href="#">…</a></span>
</div>
<div class="byline">Curated & built by <a class="ln" href="https://www.linkedin.com/in/abhaybhuva/" target="_blank" rel="noopener">Abhaykumar Bhuva ↗</a></div>
</header>
<section class="knowledge" aria-label="Out of the box fact">
<div class="kn-main">
<div class="kn-eyebrow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l1.6 4.6L18 9l-4.4 1.4L12 15l-1.6-4.6L6 9l4.4-1.4z"/><path d="M19 14l.7 2 .2.1 2 .7-2 .7-.2.1-.7 2-.7-2-.1-.2-2-.7 2-.7.1-.2z"/></svg>
Out of the box
</div>
<p class="kn-fact" id="kn-fact" aria-live="polite"></p>
</div>
<div class="kn-actions">
<a class="kn-jump" id="kn-jump" href="#" hidden></a>
<button class="kn-btn" id="kn-surprise" type="button">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 3h5v5M21 3l-7 7M8 21H3v-5M3 21l7-7M21 16v5h-5M14 14l7 7M3 8V3h5M10 10 3 3"/></svg>
Surprise me
</button>
</div>
</section>
<button class="totd" id="totd" type="button" hidden>
<span class="totd-k">Term of the day</span>
<span class="totd-sym" id="totd-sym"></span>
<span class="totd-name" id="totd-name"></span>
<span class="totd-go" aria-hidden="true">→</span>
</button>
<div class="toolbar">
<div class="tb-row">
<label class="search">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
<input id="search" type="text" placeholder="Search terms…" autocomplete="off" spellcheck="false" />
</label>
<div class="seg" id="viewseg" role="tablist" aria-label="View">
<button class="seg-btn active" data-view="topics" role="tab" aria-selected="true">Topics</button>
<button class="seg-btn" data-view="timeline" role="tab" aria-selected="false">Timeline</button>
<button class="seg-btn" data-view="list" role="tab" aria-selected="false">A–Z</button>
</div>
<button class="pill-btn quiz-launch" id="quiz-open" type="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.1 9a3 3 0 1 1 4.4 2.6c-.8.5-1.5 1.2-1.5 2.4"/><path d="M12 17h.01"/></svg>
Quiz me
</button>
</div>
<div class="legend" id="legend"></div>
<div class="tb-row tb-filters">
<div class="levelfilter" id="levelfilter">
<span class="lf-label">Level</span>
<button class="lchip active" data-level="0">All</button>
<button class="lchip" data-level="1">Beginner</button>
<button class="lchip" data-level="2">Intermediate</button>
<button class="lchip" data-level="3">Advanced</button>
</div>
<div class="progress" title="Terms you've marked as learned">
<div class="pbar"><div class="pbar-fill" id="pbar-fill"></div></div>
<span class="pcount" id="pcount">Learned 0 / 150</span>
</div>
</div>
</div>
<noscript>
<div class="noscript-msg">This interactive guide loads its 150 concepts with JavaScript. Please enable JavaScript to view and explore it.</div>
</noscript>
<div class="view" id="view-topics"></div>
<div class="view" id="view-timeline" hidden></div>
<div class="view" id="view-list" hidden></div>
<footer id="footer">
<div class="foot-line" aria-live="polite"><b id="visitors-bottom">…</b> visitors to this page</div>
<div class="foot-line" id="foot-meta"></div>
<div class="foot-line"><a class="ln" id="suggest-link" href="https://github.com/abhaybhuvagithub/neuralstack/issues/new" target="_blank" rel="noopener">Suggest a term ↗</a></div>
<div class="foot-byline">Curated & built by <a class="ln" href="https://www.linkedin.com/in/abhaybhuva/" target="_blank" rel="noopener">Abhaykumar Bhuva ↗</a></div>
<div class="foot-line" style="margin-top:6px">Built with <a class="ln" href="https://www.anthropic.com/claude" target="_blank" rel="noopener">Anthropic Claude ↗</a></div>
</footer>
</div>
<div class="tmenu-scrim" id="tmenu-scrim"></div>
<nav class="tmenu" id="tmenu" aria-label="Topics navigation">
<div class="tmenu-head">Jump to a topic</div>
<button class="tmenu-item tmenu-all" id="tmenu-all" type="button">Show all topics</button>
<div id="tmenu-list"></div>
</nav>
<button class="asst-fab" id="asst-fab" type="button" aria-label="Open the page assistant" title="Assistant">
<span class="asst-badge" aria-hidden="true"></span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a7 7 0 0 1 7 7v1a7 7 0 0 1-7 7H8l-4 3v-4a7 7 0 0 1-1-3.5V10a7 7 0 0 1 7-7z"/><circle cx="9" cy="11" r="1"/><circle cx="15" cy="11" r="1"/></svg>
</button>
<aside class="asst-panel" id="asst-panel" role="dialog" aria-label="Page assistant">
<div class="asst-head">
<div class="asst-avatar" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="7" width="16" height="12" rx="3"/><path d="M12 3v4M9 13h.01M15 13h.01"/></svg></div>
<div class="asst-title"><b>Assistant</b><span>acts on this page · no external AI</span></div>
<button class="asst-close" id="asst-close" type="button" aria-label="Close assistant">✕</button>
</div>
<div class="asst-log" id="asst-log"></div>
<div class="asst-foot">
<input class="asst-input" id="asst-input" type="text" placeholder="Ask or command… e.g. explain, search, quiz" autocomplete="off" spellcheck="false" />
<button class="asst-send" id="asst-send" type="button" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 2 11 13M22 2l-7 20-4-9-9-4 20-7z"/></svg></button>
</div>
</aside>
<div class="scrim" id="scrim"></div>
<aside class="detail" id="detail" role="dialog" aria-modal="false" aria-labelledby="d-name">
<button class="close" id="close" aria-label="Close">✕</button>
<div class="d-top"><span class="d-num" id="d-num"></span><span class="d-sym" id="d-sym"></span></div>
<div class="d-name" id="d-name"></div>
<span class="d-cat" id="d-cat"><span class="dot"></span><span id="d-cat-label"></span></span>
<p class="d-desc" id="d-desc"></p>
<div class="d-example" id="d-example" hidden><span class="d-label">Example</span><pre id="d-example-text"></pre></div>
<div class="d-prod" id="d-prod" hidden><span class="d-label">Production pattern · cloud / fintech</span><pre id="d-prod-text"></pre></div>
<div class="d-debug" id="d-debug" hidden><span class="d-label">Debugging</span><pre id="d-debug-text"></pre></div>
<div class="d-test" id="d-test" hidden><span class="d-label">Testing</span><pre id="d-test-text"></pre></div>
<div class="d-live" id="d-live" hidden><span class="d-label">From a live app</span><pre id="d-live-text"></pre></div>
<div class="d-related" id="d-related" hidden><span class="d-label">Related</span><div class="d-related-chips" id="d-related-chips"></div></div>
<div class="d-actions">
<button class="d-learn" id="d-learned" type="button"></button>
<div class="d-links">
<button class="d-link" id="d-copy" type="button">Copy definition</button>
<button class="d-link" id="d-sharelink" type="button">Copy link</button>
<a class="d-link" id="d-more" target="_blank" rel="noopener">Learn more ↗</a>
</div>
</div>
</aside>
<div id="tooltip" aria-hidden="true"></div>
<div class="quiz-overlay" id="quiz" hidden role="dialog" aria-modal="true" aria-label="Quiz">
<div class="quiz-card">
<button class="close" id="quiz-close" aria-label="Close quiz">✕</button>
<div class="quiz-head">
<span class="quiz-eyebrow">Quiz</span>
<span class="quiz-score" id="quiz-score">Score 0 / 0</span>
</div>
<p class="quiz-q" id="quiz-q"></p>
<div class="quiz-opts" id="quiz-opts"></div>
<div class="quiz-foot">
<span class="quiz-feedback" id="quiz-feedback"></span>
<button class="pill-btn quiz-launch" id="quiz-next" type="button" hidden>Next →</button>
</div>
</div>
</div>
<script>
const FAMILIES = {
foundations:{label:"Syntax & Basics", c:"#4b8bbe"},
training:{label:"Built-in Types & Structures", c:"#ffd043"},
architecture:{label:"OOP & Classes", c:"#2dd4bf"},
generative:{label:"Functions & Functional", c:"#ff6fae"},
language:{label:"Concurrency & Async", c:"#6c8cff"},
systems:{label:"Typing & Modern Python", c:"#ff8a4c"},
evaluation:{label:"Standard Library", c:"#38bdf8"},
agents:{label:"Modules, Packaging & Tooling", c:"#5fd068"},
safety:{label:"Errors, Testing & Debugging", c:"#f6685e"},
data:{label:"Cloud & Fintech", c:"#31c48d"}
};
// symbol -> [name, family, description]
const D = {
// Syntax & Basics
var:["Variables","foundations","Names bound to objects by reference; assignment never copies, it rebinds a label."],
ind:["Indentation blocks","foundations","Python uses indentation, not braces, to delimit blocks — whitespace is syntax."],
"if":["if / elif / else","foundations","Conditional branching that runs the first block whose test is truthy."],
"for":["for loop","foundations","Iterates over any iterable, binding each item in turn — no manual index needed."],
whl:["while loop","foundations","Repeats a block while a condition stays truthy; pair with break/continue."],
rng:["range()","foundations","A memory-cheap lazy sequence of integers, ideal for counted loops."],
"in":["in / membership","foundations","Tests containment (x in coll) and drives for-loops; O(1) on sets and dicts."],
"is":["is / identity","foundations","Compares object identity, not value — use == for equality, is only for None."],
walr:["Walrus :=","foundations","Assignment expression that binds and returns a value inline (Python 3.8)."],
tern:["Conditional expression","foundations","The inline 'a if cond else b' form for choosing a value in one line."],
fstr:["f-strings","foundations","Formatted string literals embedding expressions: f\"{amount:.2f}\" (Python 3.6)."],
tstr:["t-strings","foundations","Template string literals returning a structured Template for safe, custom interpolation (Python 3.14)."],
slc:["Slicing","foundations","seq[start:stop:step] extracts subsequences and can reverse or stride."],
unpk:["Unpacking * / **","foundations","Spread iterables and mappings into calls, assignments and literals."],
doc:["Docstrings & comments","foundations","Triple-quoted docstrings document objects and power help() and tooling."],
// Built-in Types & Structures
int:["int","training","Arbitrary-precision integers that never overflow — safe for large counters and ids."],
flt:["float","training","IEEE-754 binary double; fast but inexact — never use it for money."],
boolt:["bool","training","A subtype of int with True/False; every object also has a truthiness."],
strt:["str","training","An immutable sequence of Unicode code points with rich methods and slicing."],
byt:["bytes / bytearray","training","Immutable and mutable sequences of raw octets for I/O, hashing and protocols."],
lst:["list","training","A mutable, ordered, dynamic array — the default general-purpose sequence."],
tup:["tuple","training","An immutable ordered sequence, hashable and usable as a dict key or record."],
dct:["dict","training","An insertion-ordered hash map with average O(1) lookup — Python's workhorse."],
sett:["set / frozenset","training","Unordered collections of unique, hashable items with fast membership and set algebra."],
none:["None","training","The singleton null object; test with 'is None', return it to mean 'no value'."],
comp:["Comprehensions","training","Concise list/dict/set builders: [x*2 for x in xs if x>0]."],
deque:["deque","training","collections.deque: O(1) appends and pops at both ends — queues and ring buffers."],
cnt:["Counter","training","A dict subclass that tallies occurrences and supports most_common()."],
ddict:["defaultdict","training","A dict that auto-creates missing values via a factory, simplifying grouping."],
heapq:["heapq","training","A binary-heap priority queue over a plain list for scheduling and top-N."],
chain:["ChainMap","training","Layers multiple mappings into one view — great for config precedence."],
froz:["Namedtuple","training","collections.namedtuple: a lightweight, immutable record with named fields."],
// OOP & Classes
cls:["class","architecture","A blueprint bundling state and behavior into objects; everything is an object."],
init:["__init__","architecture","The initializer run on a new instance to set up its attributes."],
self:["self","architecture","The explicit reference to the current instance passed to every method."],
inh:["Inheritance","architecture","A class derives from bases, reusing and specializing their behavior."],
sup:["super() / MRO","architecture","Cooperative delegation up the C3-linearized method resolution order."],
prop:["property","architecture","A managed attribute with getter/setter logic behind plain attribute syntax."],
clsm:["classmethod","architecture","A method bound to the class (cls), often used as an alternative constructor."],
statm:["staticmethod","architecture","A namespaced function inside a class that takes neither self nor cls."],
dcls:["dataclass","architecture","@dataclass auto-generates __init__, __repr__ and __eq__ from annotations (3.7)."],
slots:["__slots__","architecture","Declares a fixed attribute set to cut per-instance memory and speed access."],
dund:["Dunder methods","architecture","Special __methods__ (__len__, __eq__, __enter__) that hook into language operators."],
abc:["Abstract Base Class","architecture","abc.ABC defines interfaces with @abstractmethod that subclasses must implement."],
enum:["Enum","architecture","A set of symbolic, singleton constants with names and values (enum module)."],
proto:["Protocol","architecture","Structural typing: any class with the right shape matches, no inheritance needed."],
meta:["Metaclass","architecture","The class of a class; customizes type creation for frameworks and ORMs."],
// Functions & Functional
"def":["def / functions","generative","First-class callables that take arguments and return values; pass them like data."],
args:["*args / **kwargs","generative","Collect variable positional and keyword arguments into a tuple and dict."],
defarg:["Default & keyword args","generative","Parameters with defaults and call-by-name for clear, flexible signatures."],
lam:["lambda","generative","A small anonymous one-expression function, handy as a key or callback."],
clos:["Closure","generative","A nested function capturing enclosing variables, carrying state without a class."],
deco:["Decorator","generative","A callable that wraps a function/class to add behavior — @cache, @app.get."],
gen:["Generator / yield","generative","A function that lazily yields a stream of values, pausing between them."],
yfrom:["yield from","generative","Delegates iteration (and sending) to a sub-generator in one statement."],
genexp:["Generator expression","generative","A lazy, memory-light comprehension: sum(x*x for x in data)."],
mapf:["map / filter","generative","Apply or select over an iterable lazily; often clearer as a comprehension."],
ftools:["functools","generative","reduce, partial, wraps and lru_cache — tools for composing functions."],
cache:["functools.cache","generative","Memoizes a function's results, turning repeat calls into O(1) lookups."],
itert:["itertools","generative","Composable lazy iterators: chain, groupby, islice, accumulate, product."],
recur:["Recursion","generative","A function calling itself; mind the default 1000-frame recursion limit."],
callable:["Callable / first-class","generative","Functions, methods, classes and any __call__ object can be passed and stored."],
// Concurrency & Async
asyncawait:["async / await","language","Cooperative, non-blocking concurrency for I/O-bound code on one thread."],
coro:["Coroutine","language","An async def object that suspends at await points until its awaitable resolves."],
asyncio:["asyncio","language","The standard event-loop framework for async networking, tasks and timeouts."],
task:["asyncio.Task","language","A scheduled coroutine running concurrently on the loop; await it for its result."],
gather:["asyncio.gather","language","Runs many awaitables concurrently and collects their results."],
tg:["TaskGroup","language","Structured concurrency that supervises child tasks and cancels on error (3.11)."],
evloop:["Event loop","language","The scheduler that drives coroutines, callbacks and I/O readiness."],
thread:["threading","language","OS threads for blocking I/O; historically serialized by the GIL for CPU work."],
lock:["Lock / RLock","language","Mutual-exclusion primitives guarding shared state across threads."],
gil:["GIL","language","The Global Interpreter Lock that traditionally serialized bytecode execution."],
freeth:["Free-threading","language","Officially supported GIL-free CPython enabling true multi-core threads (3.13/3.14, PEP 779)."],
tpool:["Executors","language","ThreadPoolExecutor / ProcessPoolExecutor run callables on pools via futures."],
mproc:["multiprocessing","language","Side-steps the GIL by running CPU-bound work in separate processes."],
queuemod:["queue.Queue","language","A thread-safe FIFO for producer/consumer hand-off between threads."],
subint:["Sub-interpreters","language","Isolated interpreters with their own state for parallelism in the stdlib (3.14, PEP 734)."],
// Typing & Modern Python
hints:["Type hints","systems","Optional annotations describing types; ignored at runtime, checked by tools."],
anno:["Deferred annotations","systems","Annotations evaluate lazily, fixing forward references and cost (3.14, PEP 649)."],
optn:["Optional / X | None","systems","A value that may be None, written T | None with the union operator."],
uni:["Union X | Y","systems","The pipe union syntax for 'either type' in hints (Python 3.10)."],
genty:["Generics list[int]","systems","Parameterize built-in containers directly in annotations for precise types."],
tvar:["TypeVar / PEP 695","systems","Type parameters enabling generic functions and classes; 3.12 adds def foo[T]."],
pspec:["ParamSpec","systems","Captures and forwards a callable's parameter signature through decorators."],
lit:["Literal","systems","Restricts a value to specific constants, e.g. Literal[\"buy\",\"sell\"]."],
tdict:["TypedDict","systems","Types the keys and value types of a dict-shaped record."],
finalt:["Final","systems","Marks a name as non-reassignable to the type checker."],
match:["match / case","systems","Structural pattern matching over shapes, mappings and classes (Python 3.10)."],
guardp:["Pattern guards","systems","An 'if' condition on a case arm that further constrains a match."],
structp:["Class patterns","systems","Destructure objects by type and attributes inside match/case."],
overload:["@overload","systems","Declares multiple typed call signatures for one implementation."],
selft:["Self type","systems","typing.Self annotates fluent methods that return their own instance (3.11)."],
// Standard Library
pathlib:["pathlib / os","evaluation","Object-oriented filesystem paths plus os for the environment and processes."],
sysmod:["sys","evaluation","Interpreter hooks: argv, path, stdout/stderr, exit and recursion limits."],
json:["json","evaluation","Serialize and parse JSON; pair with default= for Decimal and datetime."],
datetime:["datetime","evaluation","Timezone-aware dates and times; store UTC and format at the edge."],
remod:["re","evaluation","Regular expressions for search, match and substitution over text."],
logging:["logging","evaluation","Structured, level-based, configurable logging — prefer it over print()."],
collmod:["collections","evaluation","Specialized containers: deque, Counter, defaultdict, namedtuple, ChainMap."],
csvmod:["csv","evaluation","Robust reading and writing of delimited data with dialects and quoting."],
sqlite:["sqlite3","evaluation","A built-in, zero-config SQL database — great for local stores and tests."],
secretsrand:["secrets / random","evaluation","secrets for cryptographic tokens; random for simulations (never for keys)."],
mathmod:["math / statistics","evaluation","Numeric functions and summary statistics without external dependencies."],
subproc:["subprocess","evaluation","Spawn and communicate with external programs safely (avoid shell=True)."],
contextlib:["contextlib","evaluation","Helpers like contextmanager and suppress for clean resource handling."],
// Modules, Packaging & Tooling
imp:["import","agents","Loads modules and packages, binding names into the current namespace."],
mod:["Module","agents","A single .py file of reusable code, imported and cached in sys.modules."],
pkg:["Package","agents","A directory of modules exposed via an importable namespace."],
venv:["venv","agents","Per-project isolated environments so dependencies never collide."],
pip:["pip","agents","The package installer that resolves and installs distributions from PyPI."],
pyproj:["pyproject.toml","agents","The standard project manifest for build system, metadata and tool config."],
wheel:["Wheel / build","agents","The prebuilt binary distribution format pip installs without compiling."],
uv:["uv","agents","A fast Rust-based installer and resolver managing envs, locks and Python versions."],
ruff:["Ruff","agents","An extremely fast linter and formatter that consolidates many tools."],
mypy:["mypy / type checkers","agents","Static analyzers that verify type hints before code ever runs."],
mainguard:["__main__ guard","agents","if __name__ == \"__main__\": separates import-time from run-time code."],
argparse:["argparse / CLI","agents","Builds command-line interfaces with typed args, help and subcommands."],
zstd:["compression.zstd","agents","Built-in Zstandard compression for fast, high-ratio data (3.14, PEP 784)."],
// Errors, Testing & Debugging
"try":["try / except","safety","Runs risky code and handles the exception types it may raise."],
raise:["raise","safety","Signals an error; 'raise ... from e' preserves the causing exception."],
"finally":["finally / else","safety","finally always runs for cleanup; else runs only when no exception occurred."],
exchier:["Exception hierarchy","safety","All errors derive from BaseException; catch specific types, not bare except."],
custexc:["Custom exceptions","safety","Domain-specific error classes (InsufficientFunds) make failures explicit."],
excgrp:["ExceptionGroup / except*","safety","Raise and selectively handle multiple concurrent errors (Python 3.11)."],
ctx:["with / context manager","safety","RAII-style scopes that acquire and reliably release resources."],
"assert":["assert","safety","A debug-time invariant check; never rely on it for production validation."],
warn:["warnings","safety","Non-fatal notices (deprecations) that can be filtered or escalated."],
pdb:["pdb / breakpoint()","safety","The built-in debugger; breakpoint() drops you into an interactive session."],
pytest:["pytest","safety","The de-facto testing framework with fixtures, parametrization and rich asserts."],
unittest:["unittest","safety","The stdlib xUnit-style testing framework with test cases and suites."],
mock:["unittest.mock","safety","Replace collaborators with configurable fakes to isolate the unit under test."],
tracebk:["traceback","safety","Fine-grained tracebacks (3.11 points to the exact sub-expression) for diagnosis."],
faulthandler:["faulthandler / logging debug","safety","Dump stacks on crashes and lean on debug-level logs for production forensics."],
// Cloud & Fintech
decimal:["Decimal","data","decimal.Decimal gives exact base-10 arithmetic with explicit rounding — the money type."],
money:["Money modeling","data","Represent amounts as integer minor units or Decimal plus a currency, never float."],
idemp:["Idempotency key","data","A client key making a retried payment or POST safe to apply exactly once."],
retry:["Retry + backoff","data","Re-issue transient failures with exponential backoff and jitter (e.g. tenacity)."],
circuit:["Circuit breaker","data","Stop calling a failing dependency for a cool-down to prevent cascading outages."],
timeout:["Timeouts / deadlines","data","Bound every remote call; asyncio.timeout and client timeouts prevent hangs."],
httpx:["httpx / requests","data","HTTP clients (httpx adds async, pooling and HTTP/2) for calling services."],
fastapi:["FastAPI","data","An async web framework with type-driven validation, docs and dependency injection."],
pydantic:["Pydantic","data","Type-annotated models that validate, coerce and serialize external data at the edge."],
sqlalchemy:["SQLAlchemy","data","The ORM/toolkit mapping models to SQL with sessions, transactions and migrations."],
kafka:["Message Queue / Kafka","data","Durable async messaging to decouple producers and consumers; consume idempotently."],
otel:["OpenTelemetry","data","Vendor-neutral traces, metrics and logs for distributed Python services."],
secretsvault:["Secrets / config","data","Load secrets from env or a vault via pydantic-settings — never commit them."],
jwt:["JWT auth","data","Verify signed bearer tokens (PyJWT) for stateless authentication and claims."],
ledger:["Double-entry ledger","data","Record every movement as balanced debits and credits in an append-only journal."],
ratelimit:["Rate limiting","data","Token-bucket throttling to shield services and enforce per-client quotas."],
hmacv:["HMAC webhook verify","data","Validate inbound webhooks with hmac.compare_digest in constant time."]
};
// difficulty: 1 beginner, 2 intermediate, 3 advanced (default 2)
const LEVEL={
var:1,ind:1,"if":1,"for":1,whl:1,rng:1,"in":1,"is":2,walr:2,tern:1,fstr:1,tstr:3,slc:2,unpk:2,doc:1,
int:1,flt:1,boolt:1,strt:1,byt:2,lst:1,tup:1,dct:1,sett:1,none:1,comp:2,deque:2,cnt:2,ddict:2,heapq:3,chain:3,froz:2,
cls:1,init:1,self:1,inh:2,sup:3,prop:2,clsm:2,statm:2,dcls:2,slots:3,dund:3,abc:3,enum:2,proto:3,meta:3,
"def":1,args:2,defarg:1,lam:2,clos:3,deco:2,gen:2,yfrom:3,genexp:2,mapf:2,ftools:2,cache:2,itert:3,recur:2,callable:2,
asyncawait:2,coro:2,asyncio:2,task:2,gather:2,tg:3,evloop:3,thread:2,lock:2,gil:2,freeth:3,tpool:2,mproc:2,queuemod:2,subint:3,
hints:1,anno:3,optn:1,uni:1,genty:2,tvar:3,pspec:3,lit:2,tdict:2,finalt:2,match:2,guardp:3,structp:3,overload:3,selft:2,
pathlib:1,sysmod:2,json:1,datetime:2,remod:2,logging:2,collmod:2,csvmod:1,sqlite:2,secretsrand:2,mathmod:1,subproc:2,contextlib:3,
imp:1,mod:1,pkg:2,venv:1,pip:1,pyproj:2,wheel:2,uv:2,ruff:1,mypy:2,mainguard:1,argparse:2,zstd:2,
"try":1,raise:1,"finally":1,exchier:2,custexc:2,excgrp:3,ctx:2,"assert":1,warn:2,pdb:2,pytest:2,unittest:2,mock:3,tracebk:2,faulthandler:3,
decimal:1,money:2,idemp:3,retry:2,circuit:3,timeout:2,httpx:2,fastapi:2,pydantic:2,sqlalchemy:2,kafka:2,otel:2,secretsvault:2,jwt:2,ledger:3,ratelimit:2,hmacv:3
};
const LEVEL_NAME={1:"Beginner",2:"Intermediate",3:"Advanced"};
function getLevel(s){ return LEVEL[s]||2; }
// approximate year a feature became prominent (by Python release)
const YEAR={
fstr:2016,walr:2019,tstr:2025,dcls:2017,proto:2019,
asyncawait:2015,asyncio:2014,tg:2022,coro:2015,freeth:2025,subint:2025,mproc:2008,
hints:2015,anno:2025,uni:2021,optn:2015,genty:2019,tvar:2023,pspec:2020,lit:2019,tdict:2019,finalt:2019,match:2021,guardp:2021,structp:2021,overload:2015,selft:2022,
pathlib:2014,contextlib:2011,secretsrand:2015,
venv:2012,pip:2011,pyproj:2016,wheel:2013,uv:2024,ruff:2022,mypy:2013,argparse:2011,zstd:2025,
excgrp:2022,tracebk:2022,pytest:2010,cache:2019,ftools:2008,enum:2013,abc:2007,
decimal:2003,pydantic:2019,fastapi:2018,sqlalchemy:2006,otel:2021,httpx:2020,jwt:2015
};
const RELATED={
decimal:["money","ledger","flt"], money:["decimal","ledger","idemp"], idemp:["retry","circuit","hmacv"],
retry:["circuit","timeout","httpx"], circuit:["retry","timeout","otel"], ledger:["decimal","money","sqlalchemy"],
asyncawait:["coro","asyncio","tg"], asyncio:["task","gather","timeout"], dcls:["slots","proto","pydantic"],
match:["structp","guardp","enum"], gil:["freeth","thread","mproc"], gen:["yfrom","genexp","itert"],
pydantic:["fastapi","hints","tdict"], fastapi:["pydantic","asyncawait","jwt"], hmacv:["jwt","idemp","secretsvault"],
comp:["genexp","mapf","dct"]
};
function getRelated(s){
if(RELATED[s]) return RELATED[s].filter(x=>D[x]);
const fam=D[s][1];
return Object.keys(D).filter(x=>x!==s && D[x][1]===fam).slice(0,3);
}
// short concept examples
const EXAMPLE={
walr:"if (n := len(data)) > 100: trim(n)",
fstr:"f\"{amount:,.2f} {ccy}\"",
tstr:'query = t"SELECT * FROM t WHERE id = {id}"',
comp:"squares = [x*x for x in nums if x > 0]",
genexp:"total = sum(x.amount for x in txns)",
dcls:"@dataclass(frozen=True)\nclass Money: minor: int; ccy: str",
match:'match cmd:\n case Buy(qty=q): ...\n case _: ...',
uni:"def price(id: int) -> Decimal | None: ...",
slc:"last3 = seq[-3:]",
unpk:"merged = {**base, **overrides}",
deco:"@cache\ndef rate(pair): ...",
gen:"def pages():\n while more: yield fetch_next()",
asyncawait:"resp = await client.post(url, json=body)",
gather:"a, b = await asyncio.gather(f(), g())",
tg:"async with asyncio.TaskGroup() as tg:\n tg.create_task(work())",
decimal:"fee = Decimal('0.029') * amt + Decimal('0.30')",
dct:"rates = {'USD': 1.0, 'EUR': 1.08}",
cnt:"Counter(words).most_common(5)",
ddict:"g = defaultdict(list); g[k].append(v)",
ctx:"with open(p) as f:\n data = f.read()",
"try":"try:\n charge()\nexcept PspError as e:\n ...",
prop:"@property\ndef balance(self): return self._bal",
proto:"class Reader(Protocol):\n def read(self) -> bytes: ...",
hints:"def add(a: int, b: int) -> int: return a + b",
cache:"@functools.cache\ndef fib(n): ...",
pydantic:"class Charge(BaseModel):\n amount: Decimal\n ccy: str",
fastapi:"@app.post('/charge')\nasync def charge(c: Charge): ...",
idemp:"if r := store.get(key): return r",
timeout:"async with asyncio.timeout(0.2):\n await call()",
json:"json.dumps(obj, default=str)",
freeth:"# python3.14t (free-threaded build)",
enum:"class Side(Enum): BUY = 1; SELL = 2",
logging:"log.info('charged %s %s', amt, ccy)",
hmacv:"hmac.compare_digest(sig, expected)"
};
// production cloud/fintech snippets (longer)
const PROD={
decimal:`# Exact money with explicit rounding — never binary float.
from decimal import Decimal, ROUND_HALF_EVEN, getcontext
getcontext().prec = 28
def compute_fee(amount: Decimal) -> Decimal:
fee = amount * Decimal("0.029") + Decimal("0.30")
return fee.quantize(Decimal("0.01"), rounding=ROUND_HALF_EVEN)
assert compute_fee(Decimal("100.00")) == Decimal("3.20")`,
money:`# Model money as integer minor units + currency; reject cross-currency math.
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class Money:
minor: int # cents
currency: str
def __add__(self, other: "Money") -> "Money":
if self.currency != other.currency:
raise ValueError("currency mismatch")
return Money(self.minor + other.minor, self.currency)`,
idemp:`# Make a charge safe to retry exactly once.
async def charge(cmd: ChargeCmd, idem_key: str) -> Result:
if prior := await store.get(idem_key): # replay stored outcome
return prior
async with db.transaction():
result = await gateway.charge(cmd)
await store.put(idem_key, result) # persist under the key
return result`,
retry:`# Retry only transient failures with exponential backoff + jitter.
import asyncio, random
async def with_retry(fn, attempts=4, base=0.05):
for i in range(1, attempts + 1):
try:
return await fn()
except TransientError:
if i == attempts:
raise
await asyncio.sleep(base * 2 ** (i - 1) + random.uniform(0, base))`,
circuit:`# Minimal async circuit breaker guarding a dependency.
import time
class CircuitBreaker:
def __init__(self, threshold=5, cooldown=15.0):
self.threshold, self.cooldown = threshold, cooldown
self.fails, self.open_until = 0, 0.0
async def call(self, fn):
if time.monotonic() < self.open_until:
raise RuntimeError("circuit open")
try:
r = await fn(); self.fails = 0; return r
except Exception:
self.fails += 1
if self.fails >= self.threshold:
self.open_until = time.monotonic() + self.cooldown
raise`,
timeout:`# Bound every remote call; propagate a deadline.
import asyncio
async def authorize(client, req):
try:
async with asyncio.timeout(0.2): # 200ms budget
return await client.post("/authorize", json=req)
except TimeoutError:
raise PaymentTimeout("authorization timed out")`,
ledger:`# Double-entry: every posting balances to zero.
from decimal import Decimal
def post(amount: Decimal, debit: str, credit: str, journal: list) -> None:
entries = [(debit, -amount), (credit, +amount)]
if sum(a for _, a in entries) != Decimal("0"):
raise ValueError("unbalanced entry")
journal.extend(entries) # append-only, immutable audit trail`,
pydantic:`# Validate and coerce untrusted input at the edge.
from decimal import Decimal
from pydantic import BaseModel, field_validator
class Charge(BaseModel):
amount: Decimal
currency: str
@field_validator("amount")
@classmethod
def positive(cls, v: Decimal) -> Decimal:
if v <= 0:
raise ValueError("amount must be positive")
return v`,
fastapi:`# Type-driven async endpoint with dependency injection.
from fastapi import FastAPI, Depends, Header
app = FastAPI()
@app.post("/charge")
async def charge(cmd: Charge,
idem_key: str = Header(alias="Idempotency-Key"),
svc: Payments = Depends(get_payments)) -> Receipt:
return await svc.charge(cmd, idem_key)`,
otel:`# Trace a payment span with OpenTelemetry.
from opentelemetry import trace
tracer = trace.get_tracer("payments")
async def charge(cmd):
with tracer.start_as_current_span("charge.authorize") as span:
span.set_attribute("payment.amount_minor", cmd.minor)
return await gateway.authorize(cmd) # child spans inherit context`,
hmacv:`# Verify an inbound webhook signature in constant time.
import hashlib, hmac
def verify(body: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)`,
ratelimit:`# Simple token-bucket rate limiter.
import time
class TokenBucket:
def __init__(self, rate: float, capacity: float):
self.rate, self.capacity = rate, capacity
self.tokens, self.last = capacity, time.monotonic()
def allow(self) -> bool:
now = time.monotonic()
self.tokens = min(self.capacity, self.tokens + (now - self.last) * self.rate)
self.last = now
if self.tokens < 1:
return False
self.tokens -= 1
return True`,
jwt:`# Verify a signed JWT and its claims.
import jwt # PyJWT
def decode(token: str, key: str) -> dict:
return jwt.decode(
token, key, algorithms=["RS256"],
options={"require": ["exp", "iss", "aud"]},
audience="payments", issuer="auth.example",
)`,
kafka:`# Consume idempotently: at-least-once delivery means dedupe.
async def handle(evt: PaymentSettled) -> None:
if await dedup.seen(evt.id): # already applied
return
await projector.apply(evt)
await dedup.mark(evt.id)`,