Learn / Advanced
Python Advanced
Concurrency, parallelism and performance: threads, processes, async/await, sockets and packaging.
8 free lessons · about 1.8 hours · runnable code, exercises and quizzes
- 1Concurrency vs parallelismConcurrency and parallelism in Python explained with a cooking example: CPU, cores, processes and threads, I/O-bound vs CPU-bound work, the GIL, free-threaded Python and which tool to choose.11 min
- 2ThreadsPython threading for I/O-bound work: ThreadPoolExecutor, submit and map, as_completed, sharing data safely with Lock and Queue, and common threading mistakes.12 min
- 3MultiprocessingUse all CPU cores in Python with ProcessPoolExecutor and multiprocessing: parallel map, chunksize, the __main__ guard, sharing results and when processes are worth it.12 min
- 4async and awaitPython asyncio explained: coroutines with async def and await, running tasks together with gather and TaskGroup, timeouts, limiting concurrency with a Semaphore, and when to choose async.13 min
- 5SocketsPython socket programming: how TCP connections work, a simple echo server and client, handling several clients, a raw HTTP request, and when to use higher-level libraries instead.13 min
- 6Performance and profilingMake Python code faster the right way: measure with timeit and cProfile, pick the right data structure, use built-ins and caching, avoid common slow patterns and know when to reach for NumPy.12 min
- 7Packaging and publishingPackage and share Python code: project layout, pyproject.toml, versions and dependencies, command-line entry points, building wheels with uv and publishing to PyPI.12 min
- 8Project: speed up API callsCase study: fetch data from many API endpoints sequentially, with a thread pool and with asyncio, measure the difference, and add rate limits, timeouts and retries like production code.20 min