one thing i had a ton of issues with in my code quality was not using modern python typing preferences - list, dict over List, Dict in 3.9+. the root of that is because claude code is just trained on a bunch of old code, and using claude code extensively, i got flamed in my review. which was very helpful because now i know better. i love making mistakes, even though it comes at the expense of my prideβthat's something i should let go of more often.
also learned about the benefits of asyncio over threadpool in python. essentially it uses a lot less memory because there's only one thread managing the event loop, versus threadpool which spawns multiple threads.
ASYNCIO (Single Thread) [Event Loop] β βββββββββββββββββββΌββββββββββββββββββ βΌ βΌ βΌ βββββββββββ βββββββββββ βββββββββββ β Task 1 β β Task 2 β β Task 3 β β [API1] β β [API2] β β [API3] β β all tasks β waiting β β waiting β β waiting β started βββββββββββ βββββββββββ βββββββββββ instantly Memory: ~1 thread, minimal overhead
THREADPOOL (Multiple Threads) ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ β Thread 1 β Thread 2 β Thread 3 β Thread 4 β ββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββ€ β [API1] β [API2] β [API3] β [API4] β β 4 tasks β waiting β waiting β waiting β waiting β running β β β β β β [API5] β [API6] β idle β idle β β tasks 5-6 β waiting β waiting β β β must wait ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ Memory: ~4 threads, higher overhead per thread