D
D
da da2021-05-12 17:16:53
IT education
da da, 2021-05-12 17:16:53

How to painlessly switch from Python to Rust?

Why did I consider switching from Python to Rust?
1) Python is slow
2) There is no adequate memory management
in python 3) In python, I have to use a bunch of megabytes of libraries (I feel dumb and useless when importing libraries)
4) Python seems like a toy language
5) Python is not suitable for microcontrollers (micropython is just toy)
6) GIL problems
Why not c/c++? I don’t know yet, I’m not interested in them (but I tried to write in c++)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Yakushenko, 2021-05-12
@IIggoorrII

Learn rust -> write rust.

V
Vasily Bannikov, 2021-05-12
@vabka

How to painlessly switch from Python to Rust?

Learn, learn, learn.
1) Python is slow

Python is surprisingly fast, especially when using PyPy, and severe lags only occur in special cases.
2) There is no adequate memory management in python

Automatic GC is one of the most adequate ways to manage memory that mankind has ever come up with.
3) In python, I have to use a bunch of megabytes of libraries (I feel stupid and useless when importing libraries)

And you import them with the thought "I don't want to spend a lot of time implementing this from scratch."
In Rust, you have to import a bunch of libraries just like in any other language that has libraries.
4) Python seems like a toy language

You really think so. Python is very powerful.
5) Python is not suitable for microcontrollers (micropython is just a toy)

Rust + MK for beginners is also a very scary thing - look at the questions from comrade eegmak , for example, to make sure of this.
Micropython is quite a production ready tool for those cases when it is enough, and you do not need to shrink into very cheap chips.
6) Problems due to GIL

What problems did you encounter in practice?)
Most likely, they can be solved by less radical methods.
IMHO : you heard from someone that Rust is a top language, and Python is a toy, and real programmers use manual memory management and implement all sorts of complex algorithms and protocols themselves.
Although they usually write that real programmers write only in C, only in Wim, and never look for answers on Russian-language forums.
If I'm right, think again about exactly what problem of yours can be solved by rast that Python can't solve.
If I haven't dissuaded you, take a rustbook (they haven't come up with a better way yet).
If you want to switch to another language, it is not necessary to grow - look towards other languages ​​\u200b\u200bwith garbage collection - for example, C #, Go, or D. All of them can be used, including on MK, with varying degrees of perversion.

S
Sergey Gornostaev, 2021-05-12
@sergey-gornostaev

Python is slow

It is necessary to inform those who write highly loaded services on it.
Python seems like a toy language

It is necessary to inform those who write highly loaded services on it.
Problems due to GIL

It is necessary to inform those who write highly loaded services on it.

A
Andrey Lesnikov, 2021-05-12
@ozkriff

On the whole, I like Vasily Bannikov 's answer , but I will add that it is unlikely that it will be possible to study Rust painlessly - the threshold for entering the language is still very severe. Unless there was before that a serious experience with FP languages ​​​​and a confused systemism like pluses.
And so, yes, it remains to read the rustbook , rbe , watch Kladov's lectures , ask incomprehensible things in beginner chats and, as a result, dive into rust-learning .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question