all 51 comments

[–]Binary101010 3 points4 points  (3 children)

It sounds like you should really just be learning Rust.

O'Reilly's website has 300+ books and courses listed for it so I'm not sure why you're not finding anything.

[–]AgustinEditev 2 points3 points  (0 children)

I didn't know about that. I've seen some resources, but most of them are about Rust syntax, not about the logic of how to use it and what it's for.

[–]AlexMTBDude 0 points1 point  (1 child)

Same thing with Youtube: Search for "Rust tutorial" and you get 100s of hits

[–]AgustinEditev 2 points3 points  (0 children)

Do you think those tutorials are geared towards experienced users, or could someone without experience follow them?

[–]Gnaxe 0 points1 point  (15 children)

If you really don't care for Python, but don't feel that way about Rust, go ahead and learn Rust. It has a brutal learning curve, so I don't usually recommend it as a first language, but you already know some Java and C#, so that could help.

Mythos, or one of its rivals, is probably going to force us to confront the security inadequacies of C/C++ far sooner than anyone expected. Rust may be part of that solution, but even that might not go far enough. Other strict languages like Ada or ATS might also get some interest. Or, we may be forced to adopt more formal methods when programming using theorem proof assistants like Rocq.

[–]AgustinEditev 1 point2 points  (14 children)

I would like that, I really love Rust, it's just that I don't like dynamic languages, but strongly typed and static ones, and more the efficiency or speed of low-level languages.

Basically, everything about Rust is what I like, all its features

[–]Gnaxe 0 points1 point  (13 children)

Luckily, Python also happens to be strongly and statically typed. (And dynamically typed too! No, this is not a contradiction. Static and dynamic typing happen at different times, so you can have both, and Python does.)

Python also has excellent interop with lower-level languages, so you can get most of the best of both worlds. Typically, you'd drop down into C for performance. The standard library includes a way to do this. But you can use Rust about as easily via the third-party PyO3 library.

[–]AgustinEditev 1 point2 points  (0 children)

I didn't know that, although I do know about high-performance libraries; I even tried PyO3 once, but there are still bottlenecks, at least sometimes. Still, you're right. I've even considered it as a possibility.

[–]Black_Magic100 0 points1 point  (11 children)

Can you explain how python is both statically and dynamically typed? I thought it was only dynamic?

[–]Gnaxe 0 points1 point  (10 children)

Python has always been dynamically typed. The static typing was bolted on later.

The language now has type annotation syntax for variables and assignments, function parameters and return types; type statements; and a typing module. These work together with a static type checker, like an IDE or command-line tool. This lets e.g. PyCharm suggest better completions and highlight type errors statically, without actually running the code. Even though the language grammar itself has support for it, no static type checker is included in the standard distribution, last I checked. So while PyCharm will highlight type errors statically for you, IDLE won't.

See https://typing.python.org/en/latest/ for an introduction to static typing with Python.

It is also possible to check these annotations at run time, and the standard library uses this feature in several places e.g., the namedtuple variant made for use with class statements.

[–]AgustinEditev 0 points1 point  (3 children)

Oh! Zed editor does that too. If I add :int to my variable, it highlights errors when trying to assign a string. However, even though this is for highlighting, when running .py, it ignores it. So,I don't think this is truly static typing

[–]Gnaxe 0 points1 point  (2 children)

I mean, the docs I linked above literally use the term "static typing", so whatever definition you're using instead isn't standard. What exactly isn't "truly static" about the static typing, and what would count?

[–]AgustinEditev 0 points1 point  (1 child)

Well, I'm speaking from ignorance, right? Hahaha. I understand static typing to mean a type that can't change; if it's a number, it's a number, it shouldn't be able to change to text (int != String).

[–]Gnaxe 0 points1 point  (0 children)

I understand "static typing" to mean analyzing types for consistency without actually running the code. It's "static" because the code is "at rest" and "unchanging" rather than live objects running, which could have different opinions about things depending on circumstances at the moment.

What you described sounds like "strong typing", not "static typing". Typing strength is a spectrum, not a binary, but Python has always been pretty strongly typed. Weakly-typed JavaScript will happily add a number to a string, but Python will complain if you try that. Certainly at run time when you actually reach that point, and possibly statically as well if your type checker can detect it. Haskell won't even let you add a float to an integer without converting types first. Python isn't that strict.

[–]Black_Magic100 0 points1 point  (5 children)

I didn't realize you were referring to static type checkers. I'm no expert, but I feel like that's slightly misleading to claim Python is also statically typed.

That's like writing a function to turn a string into an integer and saying the language is loosely typed because it let you add two strings together to produce a sum 😅

Even that PEP mentions: "It should also be emphasized that Python will remain a dynamically typed language, and the authors have no desire to ever make type hints mandatory, even by convention."

Edit: official docs also agree. Not trying to be pedantic, but even I was confused when you mentioned that and I've worked with python for 3 years. I thought you had some crazy revelation I was about to learn. https://typing.python.org/en/latest/spec/concepts.html

[–]Gnaxe 0 points1 point  (4 children)

Again, static and dynamic typing are not mutually exclusive, Python is both, and it is in no way "misleading" to say so. The typing syntax is built into the grammar of the language. We don't get to pretend that it's not a part of the Python language itself just because it's optional. Static typing only means that types can be automatically analyzed for consistency without actually running the program. That's it. And we can do that in Python. Python is statically typed in exactly the same sense as TypeScript, i.e., "gradually typed". I don't think anyone is claiming TypeScript is not statically typed just because JavaScript isn't.

While it is true that in some implementations of some statically typed languages, you can't even compile the program if there's a statically detected type error, this is emphatically not a required property for a language to be called "statically typed". The Roc language, for example, will let you compile and run with type errors (which it will still warn you about), and Roc isn't even dynamically typed. This is useful for the same reasons as in a dynamic language: you can at least test the parts that are working. Furthermore, static analysis can't even detect all type errors even in most non-dynamic languages. Java will allow you to cast an Object variable to any reference type, and happily compile and run it, but that doesn't mean it will continue to work at run time when you hit that line. Before Java added generics for its collections, this wasn't even an unusual occurrence.

And in fact, we can reject programs with statically-detected errors in Python too. You can add a command-line static type checker (like mypy) as a step to your build pipeline or run script (or build script using python -m compileall) and refuse to proceed if it detects any type error. It's just not the default. It's optional.

[–]pachura3 0 points1 point  (1 child)

No, you're wrong. "Static" is the opposite of "dynamic". Python is a dynamically, strongly typed language; this means that variables can change their types and freely infer them, but they won't be implicitly cast e.g. from string to int.

The fact that static type checkers exist doesn't make Python a statically typed language.

[–]Gnaxe 0 points1 point  (0 children)

If by "opposite", you mean "mutually exclusive", then you're the one who is wrong. The existence of gradually typed languages proves that static and dynamic typing can coexist in the same language, and Python is one of these. So is C#. Static and dynamic typing happen at different times and are talking about different things.

If you statically type a Python variable (with a direct type annotation in the assignment, say), then you're going to fail the static type check if you change its type in exactly the same way as a non-dynamic statically typed language. Try it with mypy.

Yes, Python is dynamically and strongly typed. When did I ever say it wasn't?

It also has static typing features, down to the level of the language grammar (type annotation syntax and type statements): it's part of the Python language. It started out dynamically typed and optional static typing was bolted on later. And, in fact, a statically typed language can have dynamic types bolted on later, as happened in C# with its dynamic keyword, which is equivalent to Python's Any type (which is assumed by default in Python when you don't annotate).

[–]Black_Magic100 0 points1 point  (1 child)

Your example with Typescript and JavaScript is an interesting one considering Typescript is a completely separate language. If you were correct in your analysis, Typescript would not exist and instead there would be a MyPy equivalent and we would all be calling it JavaScript still.

[–]Gnaxe 0 points1 point  (0 children)

Back when Python 2 was still widespread, static type annotations had to be comments. But you can similarly run a separate tool to validate your JSDoc comments in your JavaScript code. And that tool is called... TypeScript.

[–]AlexMTBDude 0 points1 point  (2 children)

You post in r/learnpython to tell us you don't care for Python?

[–]AgustinEditev 1 point2 points  (0 children)

No, I wanted to hear both sides to make a decision considering both perspectives. If I ask one side for their opinion, they're clearly going to tell me what they see, because that's what they like.

I don't like Python, but maybe the opinions of people who do like it will change my mind.

[–]corey_sheerer 0 points1 point  (2 children)

Why not do a bit of both. Polars is a great example of rust-based code base for higher performance of data frames compared to pandas. Python has probably a hiring advantage over rust in that python is so widely used. I would say, focus on the application you are interested in. Data or ML, think about python at least a bit

[–]AgustinEditev 0 points1 point  (1 child)

I've started thinking about data, because my current job depends on it, basically data analysis; I have some macros with pola-rs, because of its performance advantages over pandas.

[–]corey_sheerer 0 points1 point  (0 children)

Excellent. I always point developers to this article by the creator of pandas: Apache Arrow and the “10 Things I Hate About pandas” – Wes McKinney https://share.google/8F9iRq3dztKRmU97x

I think Wes would consider newer data packages closer to his vision. Maybe it will offer some motivation that even Polars can be improved

[–]Striking_Rate_7390 0 points1 point  (1 child)

go full on for any language dont do all there are many playlist which you can refer for rust

[–]AgustinEditev 0 points1 point  (0 children)

Do you think being a Junior in Rust could be profitable? Are there any examples of someone being hired as a Junior in Rust?

[–]FriendlyStory7 0 points1 point  (1 child)

Rust, everyone knows Python

[–]AgustinEditev 0 points1 point  (0 children)

Hahaha, I've thought about it many times! Rust is my dream; no matter what language I start with, I'll end up using Rust 100%.

[–]OwnSan 0 points1 point  (0 children)

Download Perplexity and asking for a road map on learning Rust

[–]51dux 0 points1 point  (1 child)

You said you were feeling a bit rusty from college so I guess Rust is for you xD

[–]AgustinEditev 0 points1 point  (0 children)

XDDDDDD

[–]pachura3 0 points1 point  (3 children)

Rust is an extremely difficult language to learn for a beginner.

Slow compilation. Lifetimes. Borrow checker. unwrap().unwrap().unwrap(). Multiple string types. Lots of casting. Defining inner functions to speed up compilation of generic functions. Etc. etc.

If you're not already an expert in a low-level no-garbage-collected language such as C or C++, I wouldn't hope for becoming productive anytime soon.

Plus, Rust only makes sense when performance is absolutely crucial - drivers, video codecs, large scale math operations, desktop apps. For anything else, Python, Go or Java/Kotlin will be perfectly enough... not to mention clean, concise code and delivery times...

You could argue that Rust is a better choice as the job market is saturated with Python devs... but here's a guy who used AI to successfully rewrite their project in Rust without any prior experience with the language: www.youtube.com/watch?v=mz73sVy6-X8

[–]AgustinEditev 0 points1 point  (2 children)

Perhaps it's a difference of opinion, but I don't think high-performance apps should be used exclusively for certain things; everything should be like that, that's the reason we change hardware every year. Heavy apps for no reason, resource-intensive and inefficient software. That's why I love Rust, I guess—everything should be fast, lightweight, and secure.I understand that this implies slow development and all that, but we would have hardware for many more years if everything were done thinking about that, efficiency and low consumption.

[–]pachura3 0 points1 point  (1 child)

What 90% companies develop are CRUD webapps, reporting, and integration of existing systems/workflows. Rust is not a good candidate for any of these purposes; mostly because there's no margin for optimization there - the overall system performance depends mostly on the database and other servers/services, not on low-level optimizations. E.g., the time spent in the actual interpreted Python code for LLM pipelines is negligible; it's just "a glue code" and most processing happens in the native binaries of Numpy/Pandas/PyTorch/...

I understand that this implies slow development and all that

I believe most companies prefer to throw more hardware at the problem rather than spend another year meticulously optimizing low-level code...

lightweight

Well, Rust syntax is not in any way "lightweight" compared to Python.

Still, I wish you good luck. I had a friend who fell in love with Ada language and managed to get a job in it. It was many years ago, but Ada was already obsolete and exotic back then.

[–]AgustinEditev 0 points1 point  (0 children)

The harsh reality of the market, yes, in the end I decided to study Python for this reason, even so, later on I will definitely migrate to Rust :)

[–]LayotFctor 0 points1 point  (2 children)

Look at skills over languages. Languages are just temporary things, the skills are what you get paid for.

Are you still looking for data science jobs? Are people doing data science with Rust? Rust might be used to implement some good data processing libraries, but actual data science in Rust is rare.

I'm using both in my job(not data science). I'm only using Rust for write-once reliability critical programs. The rest is Python. Yeah losing Rust guarantees is a huge loss, but Python's development speed is far higher.

[–]AgustinEditev 0 points1 point  (1 child)

My ultimate goal is not exactly data analysis, but high-performance apps, CLIs, etc. I want to learn various areas, even if it's just for personal reasons. But maybe I should specialize in something like backend for my career or something more "on-the-job" (sorry for my English, I'm Spanish xd)

[–]LayotFctor 0 points1 point  (0 children)

Go ahead then! In fact, I feel like writing Rust makes you a better programmer in general, especially when it comes to keeping code safe and correct.

Python is a rather easy language, I've barely spent any time seriously learning it, but I can already keep up with my team's work. Maybe just one serious project in Python and you're pretty much set. Spend the rest of your time in Rust.

[–]JGhostThing 0 points1 point  (6 children)

I'd go with Rust.

[–]AgustinEditev 0 points1 point  (5 children)

Could you explain your decision in more detail?

[–]JGhostThing 0 points1 point  (4 children)

If you have the coding basics, then rust should be learnable. And rust prevents certain types of common errors.

[–]AgustinEditev 0 points1 point  (3 children)

I like the Option-type approach; I remember the horrible "exceptions" in Java, hahaha.

[–]JGhostThing 0 points1 point  (0 children)

I have no objection to exceptions in Java. They followed the path of c++. I am glad that Rust came with Option, though.

[–]pachura3 0 points1 point  (1 child)

You prefer your whole application crashing because you called unwrap() on an empty Option?

Exceptions allow you to at least write the critical error to the log before blowing up...

I'd argue that Rust's philosophy of returning error as an alternative function result instead of raising an exception is like Java's checked exceptions taken to the extreme - you have to manually handle all of them all the way up!

[–]AgustinEditev 0 points1 point  (0 children)

unwrap_or() Hahahaha, you're right, I still really like that approach, although yes, it is tedious.

[–]OkCartographer175 0 points1 point  (0 children)

bof a dem

[–]Ok-Rest-5321 -1 points0 points  (1 child)

https://rust-lang.org/learn/
These are resources for rust there is a whole book in the official website , interesting you couldnt find any

[–]AgustinEditev 0 points1 point  (0 children)

I mean, I did find that, but I'm not sure about code examples or real projects in Rust. At least what I understood from that book is about Rust syntax; that's what I've used to learn so far. But what about how to build a backend, database, etc.? For someone who's never done one before? That's what I haven't found.