Skip to content
LumenaryAcademy

Lumenary CS · Programming languages

Python

Beyond the basics: the data model, iteration, functions, classes and types, the tools and tests of real projects, concurrency and performance, as experienced Python programmers use them.

Python is a general-purpose, dynamically typed language first released by Guido van Rossum in 1991. It is known for code that reads almost like pseudocode and for a very large standard library and package ecosystem, and it is used for scripting and automation, web back ends, data analysis, scientific computing, teaching, and most of today's machine-learning research and tooling.

The Start level of Lumenary CS already teaches programming basics in Python, so this course does not. It is for people who can write small Python programs (variables, loops, functions, lists and dictionaries) and want to master the language itself: how its object model and special methods work, why iterators and generators matter, how decorators, classes, dataclasses, protocols and type hints fit together, how errors and resources are handled, how professionals structure, package and test a project, how Python does concurrency (the GIL, threads, processes, asyncio and the new free-threaded builds), and how to measure and improve performance. It ends with a complete small project in idiomatic style.

To run the code yourself, install CPython from python.org/downloads (or with a tool such as uv). Python has no official online playground, but every block with a Run button runs right here in your browser, using Pyodide. Those blocks are written to work on Python 3.10 and later; the complete programs that need a newer Python or something a browser cannot do (threads, processes) were run with CPython 3.13 by Lumenary's test suite, and the output shown is the output they printed. The lessons were drafted with AI assistance and are awaiting review by a human computer scientist.

AI-draftedAwaiting review by a computer scientist
  • Chloe · The Designer
    “Why is the language built this way?”
  • Margaret · The Profiler
    “What does it print, and what does it cost?”
  • Gideon · The Language Lawyer
    “What exactly does the language guarantee?”

Foundations · 3 lessons

Foundations

Python's history and philosophy, its toolchain, and the machinery under every line you write: names and objects, the data model and its special methods, and the iteration protocol with generators and comprehensions.

  1. 1The Python wayWhere Python came from, how its community decides things, how to run it, and the object model under every line you write. 50 min
  2. 2The data modelHow len, +, ==, in, for and print find their way into your own classes, through special methods. 55 min
  3. 3Iteration, generators and comprehensionsThe protocol behind every for loop, functions that pause, and the toolbox for working with streams of data. 55 min

Practice · 4 lessons

Practice

Functions as objects, closures and decorators; classes, dataclasses and protocols; type hints with a static checker; and exceptions, exception groups and context managers.

  1. 4Functions, closures and decoratorsEvery kind of parameter, functions as values, how closures capture variables, and the decorators you meet in every framework. 60 min
  2. 5Classes, dataclasses and protocolsHow Python's classes really work, how modern code avoids boilerplate with dataclasses, and two ways to describe an interface. 60 min
  3. 6Type hints and static checkingAnnotating a dynamic language, letting a checker find bugs before the program runs, and adopting types in a real codebase. 55 min
  4. 7Exceptions and context managersRaising, catching and designing exceptions, handling several failures at once with exception groups, and guaranteeing cleanup with the with statement. 55 min

Professional · 3 lessons

Professional

Structure, package and test a real project, choose between threads, processes and asyncio, then build, test and profile a complete tool made from the standard library.

  1. 8Modules, packages, environments and testsHow import really works, how professionals lay out, isolate and describe a project with pyproject.toml and uv, and how they test it with pytest. 60 min
  2. 9Concurrency: threads, processes and asyncioWaiting versus working, what the global interpreter lock does, and how to choose between threads, processes, asyncio and the new free-threaded Python. 65 min
  3. 10Project: a log report, built, tested and profiledA complete command-line tool from the standard library, written in idiomatic style, tested with pytest and measured with a profiler, then where to go next. 70 min

Further reading and resources

  • Python · Python Software FoundationThe official website: downloads, news, community and events.
  • Python documentation · Python Software FoundationThe tutorial, the library reference, the HOWTOs and the What's New pages for every release.
  • The Python Language Reference · Python Software FoundationThe closest thing Python has to a specification: syntax and semantics, including the data model.
  • Python Enhancement Proposals (PEPs)Where every significant change to the language was proposed, argued and decided.
  • Status of Python versionsWhich versions are current, which receive only security fixes, and when each reaches its end of life.
  • PyodideCPython compiled to WebAssembly: what runs the Run buttons in these lessons.