If AI Can Write Code, Is Rust Still Worth Learning?
At the end of the month, I have to present a financing model to the board. The pain point is that changing definitions messes everything up. Originally, I used Python scripts for discounted cash flow. CSV tables come in, pandas (and similar table processing libraries) clean them, loops stack up, and net present value and internal rate of return come out. When business rules adjust, AI adds two lines in Cursor, looks runnable, but the valuation doesn't match. Recently, after using Claude Code for three weeks, I tried moving the hottest computational core to Rust, keeping Python only for reports and interaction.
Let me explain first: Rust is a compiled language leaning towards the system layer, emphasizing memory safety and performance. Python is the most convenient glue language in data science. The core idea of that Hacker News article is: if AI already knows how to code, Python's ease-of-use advantage is weakened, so why not let it write faster, safer Rust? In practice, engineering details determine whether it's worth it.
I had Claude Code generate a Rust crate (Rust's package), inputting cash flows, discount rates, tax rates, and outputting valuation results. Running cargo build (Rust's build tool) in the terminal resulted in a pile of red errors: lifetimes, types, trait constraints—all compilation errors. The bottlenecks were real too. Financial data is dirty; dates, null values, and units aren't unified. In Python, a few lines could patch it over; in Rust, the entry points must be written robustly. My testing showed that table parsing and outlier handling required several rounds of adjustment to pass.
After successful compilation, boundary errors decreased significantly. Null values, out-of-bounds, type inconsistencies no longer wait until runtime to error out. Later, when I called the Rust module from Python, results were consistent, and calculations were indeed more stable. For financial models, saving time mainly comes from validation and definition stability; loop speed is only part of it.
From a financial perspective, benefits include several items. Core calculations are more stable; valuation models fear formula definition drift the most, and Rust's compiler can catch some low-level errors before launch. Long-term maintenance saves engineering debt; if this logic needs to go into APIs and be called by multiple teams later, future changes will be fewer than with "runnable but unreliable" scripts. Compute costs may also drop, attractive for high-throughput scenarios like batch backtesting and real-time risk control.
The downsides are more realistic. Talent costs rise; things Python analysts can change usually require engineering teams to take over in Rust. Ecosystem path dependency remains; Python's data science libraries are mature, while Rust's alternatives for financial analysis and data cleaning aren't as smooth. Cash flow matters too. If the company needs quick models to show investors now, the migration timeline and debugging costs might hurt more than the saved compute costs.
My judgment is: it depends. Suitable for companies with stable engineering teams, long-term reuse of core computations, and models going into production. Not suitable for small teams with only two or three analysts, weekly changing business definitions, and main needs being report generation and storytelling. A more pragmatic approach might be keeping Python for reports and interaction, replacing only the hottest computational core with Rust.
If next year's financing model needs to connect to real-time data, this calculation must account for accident costs, engineer costs, and timelines together.
📌 This article is compiled from Hacker News, original source: https://medium.com/@sarathm09/if-ai-writes-the-code-why-is-half-of-pythons-ecosystem-now-written-in-rust-e9dcf66203e4
Copyright belongs to the original author. This article is a compilation and independent analysis based on public reports.
Physix Frontier