Is Rust Really Worth the Hype? A Python Dev’s Early Verdict (Spoiler: It’s...

Rust: Discovering Syntax, Concepts, and Early Insights into Rust Programming

Yash
4 min readJan 1, 2024
Rust Programming language Icon printed on the rusted wall by author

As a data scientist who primarily uses Python, I’m always curious when a new programming language starts generating buzz in the tech community. Lately I’ve been hearing more and more about Rust and how it’s loved by many developers for its performance, safety guarantees, and applicability for system programming. I decided it was time to jump in and find out what everyone was excited about!

In this post, I’ll share my initial impressions after spending a few days going through the Rust documentation and writing some simple programs. As a complete Rust beginner coming from a Python background, I was eager to get hands on with this hot new language.

✨ First Glance at Rust Syntax:

The first thing I noticed when looking at Rust code examples is the syntax is quite different from Python.

There are curly braces, semicolons, and keywords like "fn" for declaring functions. The documentation points out Rust uses snake_case for variable names rather than camelCase.

Coming from Python, Rust’s syntax seems a bit more cluttered and lower level at first. But I know syntax can be learned over time, so I focused more on grasping bigger picture concepts.

The Rust programming language introduces critical ideas such as ownership, borrowing, and lifetimes to ensure secure memory management while also resolving potential language flaws. This emphasis on memory safety attracted my curiosity, since it provided a viable alternative to the issues seen in Python.

🧑‍💻 Installing Rust and Writing a Simple Program:

Getting set up with Rust was pleasingly easy. I installed the Rust compiler (rustc) and package manager (Cargo) from the official website. Then I wrote a simple Hello World program like:

fn main() {
println!("Hello World!");
}

To compile and run a Rust program, use rustc main.rs to compile the source code in the main.rs file into an executable binary. Then, execute the compiled binary with ./main

It was cool to have it working so quickly! The Rust community emphasizes approachable documentation which helped me get started.

Rust Programming: playground window screen

You can also experiment with Rust in the playground provided on the website if you prefer not to go into the installation process.

🧪 Experimenting with Key Rust Concepts:

I tried out examples of core ideas like functions, structs, enums, match expressions, and more.

The ownership system felt unfamiliar coming from Python, but I could appreciate how it prevents entire classes of bugs. The enum type gives nice compile time safety. And features like pattern matching seem handy.

I plan to dig deeper into these as I build actual projects.

💭 Thoughts So Far on Pros and Cons:

Here are some early pros and cons I've noted about Rust:

Pros:

  • Rust is really fast, as fast as languages like C or C++.
  • It helps catch mistakes early with strong checks during compilation.
  • Great for working with low level control and systems programming.
  • Allows for high level convenience without sacrificing performance.

Cons:

  • Rust’s syntax can be a bit more wordy compared to Python, which might feel a bit messy.
  • Learning how ownership and borrowing work in Rust takes some time.
  • While Rust’s library collection is growing, it’s not as big as some other languages.
  • It might take a bit longer to quickly try out ideas in Rust compared to dynamic languages like Python.

So in summary, Rust has some clear strengths but also differences from the dynamic scripting languages I’m used to. I’m excited to keep learning Rust more deeply and see how it could complement my Python skills. I’ll keep sharing my learning progress and findings..🚀✨

P.S. Ever wondered if spamming the 👏 clap button here on Medium is the secret workout for your finger? Give it a try and let me know if your finger gains superpowers! 💪😎

Next Arcticle on Rust:

References:

Click ➡️ subscribe if you want to see more content like this, your support 🫶 fuels me to keep writing! 🌟🧑‍💻🚀

--

--

Yash

I'm a Data Scientist & Renewable Energy geek 🌱 Exploring Data📊, Green tech🌍, and Innovation💡 Hope to write on Data Science, Life, & Everything in between ;)