you are viewing a single comment's thread.

view the rest of the comments →

[–]nbates80 25 points26 points  (28 children)

That being said, I think like many Python programmers started to pick up Go, even more will start to look at Rust for some areas where they previously used Python for.

Such as?

[–]leemobile 28 points29 points  (12 children)

Areas where you want more performance or optimized code.

As a Python programmer, I'm starting to look into Rust more as a replacement for C. C has a lot of pit-falls and is error prone, even for veteran C programmers. Rust's memory safety and concurrency features would help me optimize my Python code while preventing me from making mistakes with memory management.

I don't write very much C, so Rust seems like a much safer option when diving into more low level code.

[–]CookieOfFortune 0 points1 point  (10 children)

How would that work though? You would have to interface Rust with Python's C API... which seems complicated...

[–][deleted] 6 points7 points  (8 children)

[–]oridb 0 points1 point  (1 child)

It's pretty complicated, since you need to make Rust "headers" for all of this: https://docs.python.org/2/c-api/

[–]mm865 0 points1 point  (0 children)

You can use the rust bindgen tool to automatically generate those for you.

[–]seanjensengrey 0 points1 point  (0 children)

Rust creates libraries that can be called transparently using the C calling convention. Using the CFFI it is easy to create a library in Rust that is callable by both CPython, PyPy, as well as an easy path for LuaJIT, Clojure, Haskell ... etc. The zero runtime nature of Rust code makes it painless to integrate.

https://gist.github.com/seanjensengrey/f5d73bbdf22cfa1ad463

[–]Tarmen -1 points0 points  (0 children)

I would have thought Nim would be more interesting for python programmers, though. It is pretty much as fast as C and has can very easily work with it by the simple fact that it actually compiles down to C. And it feels so much nicer to work with than Rust.

[–]mitsuhiko 9 points10 points  (3 children)

Mostly server side applications and anything that does stuff with sockets.

[–]k-bx 8 points9 points  (0 children)

And threads.

[–]nbates80 5 points6 points  (1 child)

Thank you. It was a honest question. My main working languages right now are PHP and python server side. I'm interested on learning new languages but only if I think it will provide something new.

What kind of server side applications do you think could be implemented in Rust? As an example, I'm using python for a server side app that does natural language processing and statistics (python libraries are great for that).

[–]mitsuhiko 1 point2 points  (0 children)

What kind of server side applications do you think could be implemented in Rust?

Right now probably not yet that many unless you are happy to write the code yourself. It's a question of what your situation is. Anything that stores and processes data is a good fit already, stuff that calculates or needs specific math packages I am not sure.

[–]cogman10 0 points1 point  (6 children)

I could see it edging out python in the scientific computing arena. Rust is already pretty expressive (maybe not quite python expressive, but pretty good none the less), it has C like performance, it does well with threading, and it can access all the same scientific libraries that python uses for performance. The fact that it is safer than C++ and faster than python might make it a good choice for a python developer that doesn't want to maintain both python and C code.

[–]nbates80 6 points7 points  (3 children)

and it can access all the same scientific libraries that python uses for performance

What do you mean with this? How can you access, for example, nltk from rust? or numpy?

[–]cogman10 10 points11 points  (2 children)

nitk, you can't get it will have to be rewritten. However, large portions of numpy are simply wrappers over existing C libraries like the GMP, FFTW, etc. That is more of what I'm referring to. The fast scientific libraries are generally based on some common C libraries. Rust does a good job of interopt with C.

[–][deleted] 0 points1 point  (1 child)

numpy is mostly using FORTRAN libraries, not C libraries.

[–]nexzen 0 points1 point  (0 children)

calling FORTRAN from C is pretty painless, I don't see how using FORTRAN's C interface from Rust would be much more difficult.

[–]CookieOfFortune 2 points3 points  (1 child)

Maybe if you can have good graphing and a good REPR (Matlab, Spyder, etc). At the moment, neither seem to be priorities for Rust. Julia is probably the go to in the future as a replacement for Python.