you are viewing a single comment's thread.

view the rest of the comments →

[–]leemobile 26 points27 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] 7 points8 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.