Python for C#/Java developers — Mission
Sections
Reading settings
No voice for this language in this browser.
More voices
Code and English terms
Off: the page’s voice reads everything, with no pause between two voices.
No voice for this language in this browser.
More voices
More voices: Microsoft Edge has natural online voices, and Windows (Settings › Time & language › Speech), macOS and Android install others.
Why I’m learning this
Section titled “Why I’m learning this”Python is everywhere around the C# and Java code I work on. Guitar Alchemist runs a governance agent and a knowledge-graph service in Python, and trains a router head with scikit-learn. IX trains its sparse autoencoder with PyTorch. TARS has two dozen Python tools, and the machine learning course of this site checks its Rust results against scikit-learn.
I can read that code, and it looks simple, until it doesn’t: a default list that remembers the previous call, a module that fails when it is imported, a type annotation that nothing checks, a dependency that isn’t declared anywhere. This course learns Python as it is written today, with its types, its tools and its tests, instead of translating C# into it line by line.
Who this course is for
Section titled “Who this course is for”You are comfortable with C# or Java: classes and interfaces, generics, collections and LINQ or streams, exceptions, a build tool and a package manager. You read and write Python in scripts, notebooks or services, and you want to write it the way Python developers do.
No Python experience is assumed. The lessons explain each feature from the C# or Java feature you already know, and show where the two differ with programs that run.
Python in one table
Section titled “Python in one table”| C# | Java | Python | |
|---|---|---|---|
| Runtime | the CLR, through dotnet |
the JVM, through java |
CPython, the python interpreter, which compiles to bytecode when a file is loaded |
| Project file | .csproj |
pom.xml, build.gradle |
pyproject.toml |
| Packages | NuGet | Maven Central | PyPI, installed into a virtual environment per project |
| Tooling | the .NET SDK | Maven, Gradle | uv, or pip and venv |
| Types | static, checked by csc |
static, checked by javac |
dynamic at run time; optional annotations checked by mypy or pyright |
| Absent value | null, nullable reference types |
null, Optional<T> |
None, an object, and X | None in annotations |
| Parameters | positional, named, constant defaults | positional only, overloads | positional, keyword, defaults evaluated once, *args and **kwargs |
| Blocks | braces | braces | indentation |
The data
Section titled “The data”The lessons use real code as material, cloned into a scratch folder and pinned on a commit:
- GuitarAlchemist/ga at
cc42d21: the governance agentApps/demerzel-agent, the knowledge-graph serviceApps/ga-graphiti-service, and the scripts ofScripts; - GuitarAlchemist/ix at
2190c68: the training code ofcrates/ix-optick-sae; - GuitarAlchemist/tars at
26c5f67: the tools oftools/python.
The lessons reduce the lines they quote to files that run on their own, and say where each one comes from. What I found in those repositories, with a way to reproduce it, is in the journal.
By the end of this course, I will be able to
Section titled “By the end of this course, I will be able to”- set up a Python project with uv, pin its interpreter and its dependencies, and run it the same way on Windows, Linux and macOS;
- explain what a name, an object and an import are in Python, and predict when two names share one object;
- choose between a list, a tuple, a dict and a set, and write comprehensions where C# would use LINQ;
- design function signatures with keyword-only and positional-only parameters, and write decorators that keep the signature they wrap;
- model data with dataclasses and protocols, and annotate code so that mypy catches what
cscwould have; - handle errors and resources with exceptions and
with; - structure a package, test it with pytest, and keep it clean with Ruff in CI;
- write iterators, generators and asynchronous code, and know when threads, processes or
asynciofit; - read NumPy and pandas code, and serve an API with FastAPI.
Outline
Section titled “Outline”| # | Lesson | You already know |
|---|---|---|
| 1 | Installing and running Python | dotnet, java, NuGet, Maven and Gradle, global.json, lock files |
| 2 | The execution model | reference and value types, == and Equals, null, block scope, static constructors |
| 3 | Built-in types and collections | List<T>, Dictionary, HashSet, arrays, LINQ, streams, decimal |
| 4 | Functions | optional and named arguments, params, varargs, lambdas and closures, attributes and annotations |
| 5 | Classes: dataclasses, properties, special methods, inheritance and protocols (coming next) | classes, records, IEquatable, ToString, interfaces |
| 6 | Type annotations: mypy and pyright, generics, Protocol, TypedDict, what is never checked at run time |
generics, nullable reference types, interfaces |
| 7 | Errors and resources: exceptions, with and context managers |
exceptions, using, try-with-resources |
| 8 | Modules and packages: imports, __init__.py, project layout, publishing |
assemblies, namespaces, NuGet packages, JARs |
| 9 | Tests: pytest, fixtures, parametrization, Hypothesis | xUnit, JUnit, FsCheck, jqwik |
| 10 | Iterators and generators: yield, itertools |
IEnumerable, yield return, streams |
| 11 | Concurrency: the GIL and free-threading, asyncio, concurrent.futures, multiprocessing |
Task, async/await, thread pools, CompletableFuture |
| 12 | Data and computation: NumPy, pandas or Polars, and an honest look at the ML ecosystem | arrays, Span<T>, ML.NET |
| 13 | Quality tooling: Ruff, formatting, pre-commit, CI | analyzers, dotnet format, Checkstyle, Spotless |
| 14 | Services: FastAPI, compared with ASP.NET Core minimal APIs and Spring WebFlux | ASP.NET Core, Spring |
| — | Journal |
The machine learning course and the course on GA’s AI use Python as a cross-check; lesson 12 links to them rather than repeating them.
Resources
Section titled “Resources”- The Python Tutorial, The Python Language Reference and The Python Standard Library, for Python 3.14
- What’s New in Python 3.14, and the Python Enhancement Proposals that the lessons cite
- uv documentation, and its changelog
- mypy documentation, pyright documentation, pytest documentation
- Python Packaging User Guide, for
pyproject.tomland the formats that uv reads and writes