Live data from Hacker News

On Learning Rust and Go: Migrating Away from Python

blog.liw.fi

261–270 of 346 posts

Re: On Learning Rust and Go: Migrating Away from Python

#261

Earlier quoted context omitted.

Yes, that is called Python.

No it isn't? The substantive portions of the software aren't written in Python. Python is a thin interface to the actual library. Users of the library who need to rapidly prototype can leverage the library using its Python frontend, but the authors of the library did not write the library in Python.

To program in CPython is to use thin wrappers around C-level implemented extension types and modules. For example, all major built-in container types.

If you program in Python for performance-critical applications, as I do, then you will frequently hand-write C-level extension modules, write extension modules in Cython, use JIT tools like numba.

All of this stuff “is Python.”

Re: On Learning Rust and Go: Migrating Away from Python

#262

Having used all three of those languages, I've commented on this before. Go is mediocre as a a language, but it has one big edge - if you're doing web backend stuff, the libraries for that are the ones used internally by Google. So they're being executed billions of times per second on Google servers and tend to be well behaved. Python tends to have multiple libraries for basic functions like the database interface,…

> Rust has no idea when to stop adding features. > I used Rust for a while, but quit about two years ago in disgust. I never want to hear "that only compiles in nightly" again.

I don't understand how you can reconcile these beliefs. They stabilized too many features, but you also want more nightly-only features to be stabilized?

It's my experience as a Rust programmer since pre-1.0 that very few libraries require nightly; they tend to be niche things (e.g. Rocket) by authors that prefer to experiment on the bleeding edge of the language over having stability or many users.

Re: On Learning Rust and Go: Migrating Away from Python

#263

Not trying to dismiss this person's work in any way, but is there any reason why this blog post should be considered notable? They clearly say at the end that they've yet to write any real-world code in either Rust or Go, and so far have just been learning about either language - so how come that this shoots up to the top of HN? Is it just the magic keywords "Rust" and "Go" that do that?

I am a Rust fanboy, and I can't see anything worthwhile in this article. I joke that any love-story about Rust will get you to a front page of HN. Yeah, Rust is awesome, and many people love it, but it is a bit ridiculous.

Re: On Learning Rust and Go: Migrating Away from Python

#264

Earlier quoted context omitted.

> Also, writing self-referential data-structures is very difficult in Rust (but not impossible) due to the type system. Not really true (at least, not nearly to the same extent) since Pin was stabilized. I suppose that only serves to prove your point about Rust still being "in research phase", though!

Then does investment in learning Rust have any merit?

Yes. If your style of problem solving suits language features like pattern matching on sum types and type classes, then Rust would probably be a more productive language for you than C++, and it would be beneficial to learn it.

Re: On Learning Rust and Go: Migrating Away from Python

#265
post #254

Earlier quoted context omitted.

I’m not sure how many people will ever even work on CRUD apps of that scale. Even a mere 1,000 req/sec adds up to 86.4M per day. That sounds like something at least as popular as Stack Overflow, for example. How many web apps are there, really, that have millions of users?

Or almost any advertisement tracker server.

Isn't that market dominated by a few, or at the max, no more than 10-15 companies? My point is just that are there really more than a few dozen or maybe a hundred companies that see more than 1000 req/sec (on web apps)?

Re: On Learning Rust and Go: Migrating Away from Python

#266

Strongly agree with author. I really like Python and at one point thought that it makes sense to write almost any project in it, since it's so versatile and I know it pretty well. After working on a quite large application and having to use lots of assert(isinstance(arg, type) at the beginning of almost every function, I began to think that a strong type system is very much needed for large projects. I believe this w…

> having to use lots of assert(isinstance(arg, type) at the beginning of almost every function

Python should not be written like this; assertions can be ignored at runtime: https://docs.python.org/3/using/cmdline.html#cmdoption-o

A much better solution is to use qualified try/except blocks to handle potential errors.

Re: On Learning Rust and Go: Migrating Away from Python

#267
post #263

Not trying to dismiss this person's work in any way, but is there any reason why this blog post should be considered notable? They clearly say at the end that they've yet to write any real-world code in either Rust or Go, and so far have just been learning about either language - so how come that this shoots up to the top of HN? Is it just the magic keywords "Rust" and "Go" that do that?

I am a Rust fanboy, and I can't see anything worthwhile in this article. I joke that any love-story about Rust will get you to a front page of HN. Yeah, Rust is awesome, and many people love it, but it is a bit ridiculous.

I wonder a little about the source of the name "Rust". That seems like an odd choice for a language name - not that it matters. Rust - being associated with old metals - makes me think of something that's been left out and abandoned. Maybe because I'm from a rural part of the country where you see a lot of rusted metal sheds or abandoned structures. Go, on the other hand, makes perfect sense - "let's go!" implies that it is something that is made to get things done and also being the first two letters of Google.

Re: On Learning Rust and Go: Migrating Away from Python

#268
post #46

Earlier quoted context omitted.

>But ultimately in Python you’re still having to add extra tests just to catch up with the default behaviour of Go and Rust. You don't though. The tests you'd write which would catch these "stupid user errors" are basic ones which you'd be remiss not to write in any language. The fact that frequently developers do choose not to write any tests at all on large code bases does mean that they start to rely heavily on co…

You’re flip flopping all over the place with your descriptions of tests. Broadly speaking, There are two types of tests being discussed here. Those are positive tests and negative tests. Positive being that the code does what you expect under normal operation. Those you’d obviously need in any language Negative tests are, amongst other things, checking that your functions behave correctly when you put garbage in. If…

Those are a only a subset of the possible negative tests, and the ones you shouldn't be writing (if you do, simply switch to another language).

Re: On Learning Rust and Go: Migrating Away from Python

#269

Earlier quoted context omitted.

Most of the above is due to a proper IDE. Python, too, has one : PyCharm. Comes with 'find usage of variables', 'jump to definition', types checking, syntax correction, import optimization and much much more. 15k with pycharm is a walk in a park \ *More than one, of course. But I use only PyCharm :)

It's nowhere near the capabilities of a good Java IDE; being Python, it's very heuristic based rather than definitive. I know that searching for a variable in Java would get me all instances, no ifs no buts. Not so with Pycharm (or any Python IDE). I support the notion that Python is unsuitable for larger codebases with all my heart.

Surely not.

I can write reflection based Java code that will make automatic renaming choke.

There are ifs and buts. They may be uncommon, but they're around.

Re: On Learning Rust and Go: Migrating Away from Python

#270
post #263

Earlier quoted context omitted.

I am a Rust fanboy, and I can't see anything worthwhile in this article. I joke that any love-story about Rust will get you to a front page of HN. Yeah, Rust is awesome, and many people love it, but it is a bit ridiculous.

I wonder a little about the source of the name "Rust". That seems like an odd choice for a language name - not that it matters. Rust - being associated with old metals - makes me think of something that's been left out and abandoned. Maybe because I'm from a rural part of the country where you see a lot of rusted metal sheds or abandoned structures. Go, on the other hand, makes perfect sense - "let's go!" implies tha…

It’s got multiple associations, the “well-worn tool” one is one of them. https://en.m.wikipedia.org/wiki/Rust_(fungus) is another.
Post reply on HN