← All writing

Notes on Learning Rust as Someone Who Thinks in Python

Python is a generous language. It handles memory for you, infers what you mean, forgives most of what you do wrong at the type level, and lets you move fast without much friction. After enough years inside it, you stop noticing the generosity. You just think that's how programming feels.

Then you try Rust.

The first week was not learning Rust. It was learning how much Python had been thinking on my behalf.

The Borrow Checker Is Not the Enemy

Every account of learning Rust eventually arrives at the borrow checker, because the borrow checker is where most Python instincts go to die. The idea is precise: every value has a single owner, references must be explicitly borrowed, and the compiler enforces all of this before your program runs. Nothing is assumed. Nothing is handled quietly in the background.

In Python, I never thought about who owned a variable. The garbage collector managed memory lifetimes, and I managed logic. That separation felt clean. In Rust, those two concerns collapse into one. You are responsible for both, and the compiler will not let you forget it.

The frustration of early Rust is real. You write something that feels obviously correct, and the compiler refuses it with an error message that reads like a formal proof. But the frustration is informative. Every compile error is the language telling you something you were implicitly assuming that isn't safe to assume. After a while, you start to hear it.

The borrow checker is not pedantic. It is honest.

What Python Abstracted Away

This is the thing that surprised me most, and that I keep returning to: Python did not just make certain things easier. It made certain things invisible. Stack versus heap. Value semantics versus reference semantics. The cost of copying data versus passing a pointer. In Python, these distinctions exist at the runtime level, but they are not part of the cognitive surface of writing code. You work at a higher layer of abstraction, and the interpreter handles everything below.

Rust removes the abstraction. Not because abstraction is bad, but because Rust is designed for contexts where the cost of abstraction is unacceptable, such as systems programming, performance-critical code, and embedded environments where you cannot afford a garbage collector pausing execution at an inconvenient moment.

Writing Rust made me understand, for the first time with any precision, what Python is actually doing when it runs my code. The garbage collector is not magic. It is a runtime making decisions about memory on your behalf, and those decisions have latency costs. I knew this abstractly before. Rust made me feel it concretely.

Thinking in Ownership

The mental model shift that Rust requires is not primarily syntactic. The syntax is learnable. The shift is in how you reason about data moving through a program.

In Python, I think about data flowing. A dictionary gets passed to a function, modified, returned, passed somewhere else. Ownership is not a category I use. In Rust, it is the primary category. Before I write almost anything, I am asking: Who owns this? Is this a reference or a move? Does this need to live for the duration of this function or longer?

These are not new questions that Rust invented. They are questions that every program implicitly answers. Rust simply makes you answer them explicitly, at the point of writing, rather than letting the runtime answer them at the point of execution. The result is code that is harder to write and significantly easier to reason about once written.

I found myself going back to old Python code with new eyes. Functions I had written casually were making implicit ownership decisions I had never examined. Most of them were fine. Some of them were the source of bugs I had never fully understood.

The Type System as a Thinking Tool

Python's type hints are useful. Rust's type system is structural. That difference is larger than it sounds.

In Python, types are annotations — they communicate intent and enable tooling, but they do not constrain the program. You can ignore them. The runtime will not stop you. In Rust, types are load-bearing. The compiler reasons about your entire program through the type system, and a type error is not a warning — it is a refusal.

This changes how you design programs. When types are merely descriptive, you can be loose with them and clean up later. When types are structural, you are forced to think carefully about your data shapes before you write the logic that operates on them. The design work moves earlier in the process.

I do not think this is objectively better. I think it is better for certain kinds of problems and certain kinds of thinking. But the discipline it installed has changed how I reach for types even when writing Python — more carefully, earlier, with more attention to what the shape of data is actually saying about the problem.

What I Carry Back

I am not a Rust programmer yet in any serious sense. I am someone who has spent deliberate time inside a language that refuses to be comfortable, and returned to my primary language changed by the friction.

What I carry back is not syntax. It is a set of questions I now ask earlier: Where does this data live? Who is responsible for it? What am I assuming the runtime will handle? What would this cost if the runtime weren't there?

Python remains the language I think in. But Rust taught me that thinking in a language means accepting its assumptions — and that the most valuable thing a second language can do is make those assumptions visible.

The discomfort was the point.

If this piece meant something to you, consider supporting the work.

☕ Buy me a coffeeMore posts →

More writing

Poetry · 3 min poem
Know Your Place
Why do I have to be perfect and digestible and great and not too annoying, while you get to be late?
Technology · 6 min read
Your Phone Knows You're Lonely Before You Do
Your phone doesn't need to read your messages to know how you're doing. It only needs to watch how you move, when you scroll, and how long you stay home.
Poetry · 8 min poem
YOU WOULD HAVE BEEN THERE TOO
Don’t act innocent. If you were there that day, you wouldn’t be the one crying at the cross. You’d be in the crowd. Yeah… you. The same mouth you use to pray? You would’ve used it to shout, “Crucify Him.”
See all writing →

Join the newsletter

Essays, poems, and ideas — delivered to your inbox. No noise, no spam. Just writing worth reading.

Free forever · Unsubscribe anytime · No spam ever