Live data from Hacker News

Introduction – Rust for Python Programmers

microsoft.github.io

21–28 of 28 posts

Re: Introduction – Rust for Python Programmers

#21

Earlier quoted context omitted.

> You may notice no language on the planet does this. That is because it is bad. Perhaps I've explained this poorly, but C#, Java, Perl, & Haskell (and I'm sure others as well) do versions of this already... You even seem to imply that Swift does, though I have almost no experience directly with Swift. The vast majority of times it is NOT ambiguous. The compiler can flag it, IFF you want it to. If you're coming from…

In none of the languages you mentioned do stdlib functions either return an iterator or a list depending on whether you feed it into an iterator operation; in none of the languages you mentioned can a fully-generic return as a method receiver be inferred by the name of the method. It has nothing to do with how well you explained it; it just doesn't exist. Every single thing you are complaining about exists in all of…

I think you're stuck completely on the iterator example or only named functions (which makes sense, since that's all you've seen), rather than several languages supporting various types of polymorphic returns and/or downstream target typing (mainly in lambdas or with sigils).

Certainly if you allow a language do something like:

```rust

fn foo() -> i32 { 42 }

fn foo() -> String { "42" }

```

That would be a nightmare.

But you can have something like:

```rust-ish

@eager_fallback(String[])

fn split(s: String, separator: Char) -> String::Iterator { ... }

```

Which, essentially, defaults to calling collect to an Array for you when bound to a variable, or when chained to a function that doesn't take an iterator but does take a String Array. And in a different mode of compilation, there are no fallbacks (you're back to Rust).

Sure, I don't know a language that supports polymorphic return exactly on `.split()`, but there are languages that support all of the different mechanisms to do this intelligently.

You're assuming the implementation is going to do a number of things that would cause either code bloat or force ambiguity (and potentially a number of other assumptions).

I think you're also assuming the type is not resolved until who knows what happens to it, rather than once it's bound.

None of those HAVE to be true.

To the best of my knowledge, for the most common cases, this can be solved, and when it can't, the compiler can flag it.

Re: Introduction – Rust for Python Programmers

#22

> Cargo vs pip/Poetry I know this section is really just a comparrison of pyproject.toml and cargo.toml, but who on earth would use pip instead of UV as a drop-in replacement in 2026? Though calling it a comparrison is a bit of a stretch considering there is no text. On top of that, I imagine that a lot of Python programmers who actually do use pip would also use requirements.txt and not pyproject.toml

Because Astral is now owned by a profit driven org, and that often becomes problematic.

Also because Pip ain't perfect, but it is stable in a sense.

Re: Introduction – Rust for Python Programmers

#23
Jeez, what a hostile crowd. I personally am just glad companies like Microsoft, that infamously used to charge for every material they put out, have been providing free learning resources to newcomers like this, quality notwithstanding.

I am just extremely grateful in general for anyone who takes the effort to put something out there for public education for free. If you are one of those, irrespective of how your content is appreciated, please take my heartfelt thanks. You guys are at the forefront of restoring my faith in humanity.

Re: Introduction – Rust for Python Programmers

#25
"microsoft", okay, off to a great start. First click in the ToC that looks interesting and something I'd actually like to know as a RUST outsider:

    Common Python Pain Points That Rust Addresses
But then number one:

    1. Runtime Type Errors
    
    The most common Python production bug: passing the wrong type to a function. 
    Type hints help, but they aren’t enforced.
Uh, okay. This rarely if ever has been a problem for me and I don't usually even use type hints.

Then comes calling out the existence of None, the GIL and packaging as common "pain points". None of these have posed any problem to me essentially ever. Packaging used to be honestly annoying but since uv hit the scene, not at all.

I should have known better and stopped after reading "microsoft".

Re: Introduction – Rust for Python Programmers

#26

Earlier quoted context omitted.

In none of the languages you mentioned do stdlib functions either return an iterator or a list depending on whether you feed it into an iterator operation; in none of the languages you mentioned can a fully-generic return as a method receiver be inferred by the name of the method. It has nothing to do with how well you explained it; it just doesn't exist. Every single thing you are complaining about exists in all of…

I think you're stuck completely on the iterator example or only named functions (which makes sense, since that's all you've seen), rather than several languages supporting various types of polymorphic returns and/or downstream target typing (mainly in lambdas or with sigils). Certainly if you allow a language do something like: ```rust fn foo() -> i32 { 42 } fn foo() -> String { "42" } ``` That would be a nightmare.…

None of the languages you mentioned support this 'eager_fallback' feature, no. I am not stuck on any one application of the feature (you'll notice I referred both to the individual application and the general feature, and then you ignored it), but rather you are overindexing on generic returns, which are insufficient for what you're describing in a load-bearing way. Rust supports what C# supports, on the subject of generics (in ways germane to this feature), and what Rust lacks, C# also lacks. So your reference to C# supporting this is false. The feature you are proposing exists in zero languages on the planet. The thing you can get, top-generic returns, exist in Rust and the languages you mentioned, and don't accomplish your named goal at all because you can't use them as a method receiver without disambiguating them.

Re: Introduction – Rust for Python Programmers

#27
My question is why will Python programmer, use Rust when they can use Go?

As someone who went from C++ to java to Ruby to Javascript to Python, to Go.

I find Go enviornment much superior. Not only your code can keep working for decade and compile fine with new compilers, you get more than enough speed you need.

And also, you don't use random libraries, you precisely use to part you need which imho makes you software more reliable, cleaner and smaller.

Using libraries and other people's module will always bite you just like llm bites you because you believe you understand it but you don't know how it's actually implemented and those who actually go through library and check all that, can implement parts they need from scratch without adding 100s of things u don't need.

Re: Introduction – Rust for Python Programmers

#28

My question is why will Python programmer, use Rust when they can use Go? As someone who went from C++ to java to Ruby to Javascript to Python, to Go. I find Go enviornment much superior. Not only your code can keep working for decade and compile fine with new compilers, you get more than enough speed you need. And also, you don't use random libraries, you precisely use to part you need which imho makes you software…

One possible reason: because Rust can interface with Python much more easily.
Post reply on HN