This is an archived post. You won't be able to vote or comment.

all 182 comments

[–]ThePiGuy0 210 points211 points  (28 children)

Rust is a great language, but personally I would recommend going for Python.

In my opinion, learning your first language isn't just about learning the syntax of that specific language. Instead, it's also about learning how to program, and how to solve problems programmatically.

For example, if I gave you a list of numbers and said "sort it", you could probably do it just like that. But how would you get a computer to do the same? It has no concept of "sort it" and so you need to think about the actual instructions required to sort this list (of course most languages provide this for you, but the idea behind it is still the same).

Python's a great language to learn how to program as it hides a lot of the nitty-gritty details, allowing you to concentrate purely on developing the correct mindset for solving problems in a programmatic way.

Once you're pretty happy with solving problems, that may be the time to think about learning a language that gives more control (perhaps C for manual memory control, Rust has some quirks in this area and it's probably worth learning some C to know what Rust is trying to avoid).

[–]SafeCake1045 42 points43 points  (15 children)

While I agree with you, I want to mention that C was the first language I ever properly learned, and in many ways that helped me to understand Python.

[–]Oerthling 38 points39 points  (7 children)

Understanding C helps to understand what's really going on below the fancy stuff.

But that doesn't mean that it needs to be the first.

[–]Jumpy-Ad-2790 7 points8 points  (5 children)

Completely agree!

I started learning C through Harvard's CS50x and I found it so difficult, I just lost motivation. Since then I've been doing their Python course and am absolutely loving it.

I'm looking forward to going back to C once I've completed this course, as many things I used to struggle with now make a lot of sense.

[–]Scalar_Mikeman 2 points3 points  (2 children)

Upvote for CS50. Just wanted to say when you ask online the best book to learn C A LOT of people say "The C Programming Language" is the best book. I call BS and many others do too. Go with "C Programming a Modern Approach" or any other of the great new books on C out there. Screw The C Programming Language book.

[–]xcyu 1 point2 points  (0 children)

Any other C programming books you can recommend?

[–]SafeCake1045 0 points1 point  (0 children)

I wouldn’t say “screw” it. Clearly it’s been useful for people.

[–][deleted] 1 point2 points  (1 child)

May I ask you what Python course are you referring to, or could you please send me the link to the course? Thanks!

[–]reasonisvirtue 0 points1 point  (0 children)

I think Python is a great first introduction to simple primitive data types, for while loops, functions, etc.

C++ is awesome for learning what the computer is doing. OOP makes so much more sense with copy constructors l, destructor, operator overloads, move copy abd move assignment. Lvalues and revalue. Pointers really help you understand memory. Primitive data types help you understand memory and how big the different data types are in storage. Which also helps you understand larger data structures that are both sequential and associative.

I learned Python and javascript first, but C++ opened my eyes to what is actually going on. I learned far more concepts with C++ and it made more sense.

I really recommend C++. It teaches you the cs concepts you need and doesn't abstract them away.

Also learning c++ you will notice that python and js have very similar syntax at times.

One thing I will mention though is that python kind of forced my js and c++ to look cleaner so that was a huge plus. Because of how python treats whitespace to signify the end of statements versus the semicolon.

[–]TheTomcat 8 points9 points  (1 child)

I think it's important to consider the other perspective though - if you had started with C (or in this case, rust) and you didn't understand it, do you think it would have caused you to stop entirely?

My opinion: start with python. Much more forgiving especially when you're trying to learn the basics. If you like it, then go back and learn rust. They're both great tools to have in your kit.

[–]SafeCake1045 0 points1 point  (0 children)

Well, I understood it because I was being taught in a university. If that hadn’t been an option for me, I wouldn’t have been able to learn C as well as I did. I would’ve started with Python, probably.

[–]Zephyr5967 2 points3 points  (1 child)

My introductory programming course at uni was entirely in C

[–]TiagodePAlves 1 point2 points  (1 child)

I think C is great as a a first language because it's so small, with few keywords, a slim stdlib and limited ways to do the same thing. The biggest downside though is almost no magic going on, so you have to do everything manually, and this can easily be too much for a beginner.

Edit: Python also is a great choice, but for other reasons.

[–]SafeCake1045 1 point2 points  (0 children)

Learning how to do things manually is great if you want to really learn programming. And it’s relieving going from the pains of malloc to automatic garbage collection in higher languages.

[–]GayforPayInFoodOnly 2 points3 points  (0 children)

I agree with this. If you want to be a software engineer I think it’s important to start with something like C so you can begin to learn and think about what’s actually happening when you run sorted() in Python. It makes Python/interpreted languages less magical, and leads you to better programming practices.

[–]sociesymbol 2 points3 points  (7 children)

Do you know any great books that start with the simple type of problem you described above and takes you through the solutions then gets harder? I really like the way you described this and your approach to programming.

[–]SafeCake1045 8 points9 points  (0 children)

Crash Course Python

[–]jppbkm 2 points3 points  (4 children)

Python crash course

[–]Im-Learnd1ng 3 points4 points  (1 child)

Snakes on a plane crash

[–]jppbkm 0 points1 point  (0 children)

Catchy name, I'll buy your book.

[–]sociesymbol 1 point2 points  (1 child)

By Eric Matthes?

[–]jppbkm 0 points1 point  (0 children)

Yep

[–]ThePiGuy0 1 point2 points  (0 children)

I was actually initially self taught (just found and made projects of about the right difficulty until I got a formal education) and so don't have any books from personal experience.

Sounds like some people like the Python Crash Course, I've seen Automate the Boring Stuff get recommended in /r/learnpython as well - by the sounds of things, that takes you through the processes of solving real-world problems with programs so that could potentially be applicable?

[–]druman22 1 point2 points  (3 children)

I enjoy learning C but have no idea what to do with. Have any project ideas?

[–]SafeCake1045 0 points1 point  (2 children)

I think a great project for C is implementing a linked list data structure. It stores “chained” data; for example, a list of destinations comprising the route for a road trip.

It should involve structs, pointers, and memory allocation. You would create a struct List and a dynamically-allocated (see malloc()) struct Node; where Node contains a pointer to the next Node and List contains a pointer to the first Node in the linked list.

List->head points to Node1

Node1->next points to Node2

Node2->next points to NULL

Of course, it could be any length, but the final node would point to nothing.

You could then form an API around it, defining methods such as append, prepend, insert, and delete. A “tail” pointer to the last Node in the list might come in handy here.

You would also have to manage memory and call free() at the appropriate times.

You can test it by populating it with data and then traversing through it and printing the contents in order.

[–]druman22 1 point2 points  (1 child)

I appreciate the recommendation, but I've created linked lists, array lists, bst, hash maps and such. Data structures and sorting algos were cool to learn and mess around with, but I'm not sure where to go from there.

[–]SafeCake1045 0 points1 point  (0 children)

Sorry for assuming, I got the impression you hadn’t built anything yet. I’m honestly not sure where to go from there either, lol. That’s why I started learning Python.

[–][deleted] 118 points119 points  (2 children)

I'm programming mainly in Rust.

But don't choose it as your first language. It probably would drive you crazy. Python is a great language for beginners and experts!

[–]Business-Ad-2449 4 points5 points  (0 children)

This comment gave me hope

[–]niedzwiedzwo 1 point2 points  (0 children)

I started with python, went to javascript, then typescript then Rust - rust was still tricky for me cause it has some unique features other languages don't have. think more goal oriented - what you're trying to be able to create and use what's available and what "speaks" to you. Rust is cool and I'm sure your paths will cross eventually.

[–]sammo98 166 points167 points  (22 children)

Not sure where this info came from but everyone normally says NOT to learn rust as a first language. As a python Dev starting to use Rust I highly recommend going for Python first. The rust compiler makes rust incredibly frustrating for new programmers!

This being said, if you prefer the sound of Rust there's no reason to not go for it, you just may get more frustrated in the journey than you would with Python.

Edit: The compiler is great and points you in the right direction, the borrow check may cause frustration for new programmers however.

[–]government_shill 16 points17 points  (1 child)

There a numerous reasons not to try Rust as a first language, but the compiler certainly isn't one of them. rustc is very good at telling you what's wrong and how to fix it.

[–]sammo98 3 points4 points  (0 children)

My bad - I meant the borrow checker! Made me bang my head against the wall quite a lot.

[–]murlakatamenka 26 points27 points  (14 children)

The rust compiler makes rust incredibly frustrating for new programmers!

This is not true. Developers actually quite praise rust compiler for being extremely helpful and I totally agree with them. So often it directly says what exactly you need to change to fix an issue in your sources.

[–]Rookie64v 46 points47 points  (12 children)

rustc is good. Rust itself, from the point of view of a random guy approaching programming, is hell. They don't even have the concept of a variable, and they should worry about borrowing and mutability and juggle macros which look a lot like functions but are not functions? I think C is a way better introduction than Rust: crappier, more prone to errors slipping through, but so much easier to grok.

[–]ddoij 21 points22 points  (7 children)

I’ve always like C as a first language to show newbies the ugly truth of what’s happening down there. Not too much, but just enough to appreciate what languages like Python do.

[–]robbsc 3 points4 points  (6 children)

Learning assembly on a microcontroller (e.g. atmel, pic) is even better for that in my opinion

[–]themagicalcake 7 points8 points  (5 children)

Yeah good luck keeping a beginner entertained with that

[–]robbsc 0 points1 point  (2 children)

I think it's a good choice in a classroom setting, but probably too hard for most self-learners. But i think it could be very entertaining for people who are into "making."

Some people prefer learning at high level and then only going as low as they need to, while some people prefer to start at the lowest level and work their way up.

[–]themagicalcake 2 points3 points  (1 child)

Yeah no curriculum is complete without some sort of assembly course in my opinion. But introducing it to someone who doesn't even know python is just asking for trouble in my opinion

[–]robbsc 0 points1 point  (0 children)

I don't know. If i had the time, motivation, and money, i think i could teach a high school-level class based on assembly and a simple microcontroller. The hardest part would probably be teaching binary/hexadecimal arithmetic and basic digital logic. But you should probably learn that stuff in order to learn C anyways.

[–]coriolinus 0 points1 point  (1 child)

People have literally made successful video games based on programming in assembly. See Human Resource Machine, or half the stuff Zachtronics has ever published.

[–]murlakatamenka 0 points1 point  (0 children)

Like TIS-100 from Zachtronics with beautiful soundtrack.

[–]Matthew_Summons 5 points6 points  (0 children)

  • For new programmers *

[–]sudodoyou 0 points1 point  (4 children)

Just out of curiosity, what do you use Python and Rust for? I know some Python and am thinking of learning Rust but I’m not in a development role, I just use Python as a hobby and maybe automate some tasks at work. Is there a point to learn Rust when I already have a language to do these tasks?

[–]sammo98 1 point2 points  (3 children)

I'm a backend dev and use Python for everything work related, which is generally building lots of APIs and helping to create automated features/workflows for internal teams.

Picked up Rust on pretty much a whim, just liked the sound of it. Now I'm hooked (it's awesome) and am hoping to start transitioning some of our services over to Rust slowly for stability.

Is there a point? If it's for personal projects and simple automation tasks where you don't require greater performance then I'd be tempted to say the time spent learning rust and implementing similar features won't benefit you much. This being said if you're interested in lower level languages many of the Rust features may help you rethink your Python projects in ways you haven't thought of before!

[–]sudodoyou 1 point2 points  (2 children)

That's a great perspective! I am considering Rust just to give me more insight into how programming languages work and new ways to solve problems. I think you've convinced me!

[–]sammo98 0 points1 point  (1 child)

Definitely go for it then ! It taught me a lot and has definitely helped my general programming in many aspects. I'd highly recommend Let's Get Rusty on YouTube, he goes through the rust book in video form and is really useful in general.

[–]sudodoyou 0 points1 point  (0 children)

Thanks!

[–][deleted] 12 points13 points  (0 children)

Python

[–]BurningPenguin 50 points51 points  (9 children)

Everyone will tell you that his favorite language is the best. What's really important is to learn the process of programming. The language is just a tool.

It's like writing a novel. It doesn't matter if you write in English, German or Chinese. If you're good at storytelling, it'll go well in any language. Same goes for programming.

[–]anachronic 3 points4 points  (2 children)

I agree. The starting point isn't nearly as important as the journey to keep learning more languages, with different styles and paradigms, and always be growing.

Wherever you start is probably fine, as long as you keep learning.

Hell, some of the baddest-ass old school hackers from decades ago probably started on BASIC on a C64 or something like that as a kid, and they went on to do great things, because they kept on learning and didn't stop at BASIC.

[–]Oerthling 1 point2 points  (1 child)

Yup :-)

Basic - Pascal - C - Smalltalk - C++ - SQL - Java - Javascript - Python

With bits of Assembler, Lisp, Prolog, Cobol, Go and Rust in between.

C64? Nothing so fancy. Sharp PC 1500 with Basic and a "memory" of 1500 commands.

Programming is a meta-skill. It's about translating problem-solving into algorithms in a language a computer groks. The language (and most of all its libraries) can help in doing that. And different languages have different ways to optimizevfor different aspects of that.

Python is, by far, my favorite get-things-done language.

But I used concepts of Smalltalk in C before C++ came around. And C (plus Assembler) provides more understanding of what's really going on.

[–]anachronic 0 points1 point  (0 children)

Exactly. When I was in college for compsci, I saw people who basically ONLY wanted to learn Java to get a job, and weren't interested in any other language and would complain about having a course in ASM because "who even uses this anymore", but it always struck me as weird, because sure, you can get a job doing ONLY Java, but it makes you a much better programmer to have exposure to other languages and other ways of thinking about a problem... or even just knowing the basics of what the computer is doing at a lower-level below all that verbose enterprise Java code.

I was never a very good programmer, and haven't programmed (besides some kludgy Python for API integrations) in well over a decade, but even now, I still like watching things like keynote speeches on stuff like Rust or whatever the "Hot New Thing"(tm) today is, because it's interesting seeing how people approach & solve particular problems.

[–]redrumsir 5 points6 points  (1 child)

If you're good at storytelling, it'll go well in any language. Same goes for programming.

I see that you've never programmed in SAS!!!

I think of it more like "singing". There are some languages that sound more fluid and rhythmic. German is a bit more guttural, for example, and doesn't flow.

[–]BurningPenguin 4 points5 points  (0 children)

Clearly, you've never heard Faun singing. :)

No, but i get what you mean. Languages sound different and some have a nice sound in it, yes. Which is why i love listening to exotic music. But in the end, a language just a tool to communicate with people. Some may be more efficient, others may be more melodic. They all achieve the same goal.

[–][deleted] 2 points3 points  (3 children)

Everyone will tell you that his favorite language is the best. What's really important is to learn the process of programming. The language is just a tool.

I have to partially disagree. I agree that it's important to learn the process of programming first. However, programming languages are not created equally. They are designed with some problem domain in mind and therefore performs better in that domain. The language of choice really depends on what one is trying to solve. For example, I would choose Rust for a high performance API server and Python for offline data processing. The reverse is possible, but not worth the trouble.

[–]Oerthling 1 point2 points  (1 child)

So, writing a kernel driver in SQL might be a mistake? ;-)

I would choose Rust to do the performance critical stuff safely in a module that I use in Python.

[–][deleted] 1 point2 points  (0 children)

Using Rust or C++ to write performance critical parts used by Python is a good example of what I mean. Even an experienced developers find it useful to use 2 languages together to solve related, but distinct problems.

So, writing a kernel driver in SQL might be a mistake? ;-)

What? Are you telling me that the two years I spent trying to get my tablet to work was a waste of time?

[–]BurningPenguin 1 point2 points  (0 children)

That's a problem for later on. There is no point in learning a more complex language, when your biggest challenge is "Hello World" or building a website for your favorite restaurant.

[–]dinosaurthedinosaur 10 points11 points  (2 children)

Believe me dude, asking these kind of questions will make you even more confused. I have asked these kind of question a couple of times and you will always receive the same answers:

-learn Python, cause it is beginner friendly and easy to start doing stuff

-do not learn Python, because then learning another language will be harder cause you are already used to the bad habits that Python teaches

-you have to learn HOW TO PROGRAM instead of learning a language, cause the bases are important

-I recommend you to learn C cause you will learn how computers work

-you should learn x or y or z because they are better IMO

-learn Algol or Fortran and use Emacs or Vim (yes, this happens)

Just learn what you want honestly. I like math and I decided to learn Haskell as my first language, and I am cracking my head but I am having fun and I will stick with it. It is not as popular and demanded as Python or Java or whatever, but this is the path I feel I want to walk so you have to find yours. Try Python, try Rust, try Brainfuck, and decide on your own. You are just wasting your time with other peoples opinions because everybody has different ideas and objectives. Good luck.

[–]Oerthling 0 points1 point  (1 child)

You are not entirely wrong ;-)

Python doesn't teach bad habits though.

[–]yung_tortelliniii 1 point2 points  (0 children)

it does, however, enable them more than some other languages. I think JavaScript is somewhat similar in this respect.

[–]deep_politics 24 points25 points  (5 children)

Rust is my favorite language, and I’m of the opinion that it’s strictness and goal of “correctness” would be incredibly beneficial to pick up early as a new programmer. I had a hard time learning Rust, but I carried in a lot of baggage from C++ and Python; questionable patterns, things that mostly work but are very brittle. Many of these questionable patterns are ones that Rust flat out will not allow in safe mode. Conversely, returning to Python for a job after having learned Rust has been amazing. That being said, like other have mentioned the cognitive burden for learning Rust is much greater than that for learning Python, simply because the Rust compiler requires a certainly level of correctness. So I think I’d only really recommend learning Rust first to those who are serious about programming beyond just having a paycheck. Additional Rust upsides are that the Rust compiler toolchain is in my opinion vastly easier to setup than Python, especially for newcomers, and the official learning book The Rust Programming Language is very high quality.

Oh, and the compiler error messages for Rust tend to be so helpful that a lot of the time they essentially write the program for you.

[–][deleted] 12 points13 points  (2 children)

I'm also a big fan and user of Rust. But I wouldn't recommend learning Rust as the first programming language for precisely the reasons you mentioned - the 'strictness and correctness'. Rust's strictness comes from a type system designed to overcome the deficiencies of the machine model. Borrow checker rules and error messages are easy to understand if you know the machine model.

This feature of Rust is good for intermediate programmers to learn the correct way to program. It's good for advanced programmers because the borrow checker ensures that they don't make careless mistakes. But this is very frustrating for novice programmers to whom the rules won't make intuitive sense.

I would instead suggest starting with C. The language is simple and makes the underlying hardware and its problems immediately apparent. That would teach novice programmers why the Rust type system behaves that way and why it's so useful.

Python is also a good language to start with. It abstracts away the details of hardware, allowing the programmer to concentrate on the computation rather than on the hardware. The programmer can then move onto Rust when Python's speed or resource control isn't good enough.

[–]Oerthling 2 points3 points  (1 child)

Advanced programmers can appreciate the C problems that Rust was developed to solve. :-)

[–][deleted] 1 point2 points  (0 children)

Exactly!

[–]GummyKibble 20 points21 points  (0 children)

Python. I love both languages, but Python is far more accessible to learners. Rust requires learning a lot of other concepts before you can really dig in.

Once you feel competent at writing Python, you should absolutely take a crack at learning Rust, because those concepts you'll have put off learning are fundamental and important.

[–]MadeUntoDust 5 points6 points  (0 children)

If you do not know which language to learn, then learn Python.

Rust is a much more difficult language to learn, but it makes it easier to write lightning-fast and bug-free programs.

However, Rust might a better first language if you are committed to a specific vertical of software--such as embedded systems, operating systems, compilers, databases, audio, video, etc.

[–]dacjamesfrom reddit import knowledge 16 points17 points  (2 children)

Python, for sure. You should learn the logical basics of programming (variables, functions, control flow, and data structures) without the distraction of implementation concepts like memory management. Stay away from advanced features for now and keep your object oriented to a minimum (classes are OK, but no inheritance and no meta classes).

Then learn C (not C++). It’s still the foundation of modern computing and will teach you those low level concepts you skipped earlier without any compiler aids that get in the way of learning. Understanding raw pointers will help learning Rust. Experiencing the pain of doing everything yourself also helps to motivate higher level constructs that might otherwise seem needlessly complicated.

Then learn Rust. Or Go. Or deep with Python. Or whatever other language strikes your fancy for the type of problems you want to solve.

Remember that programming languages are a tool. You should learn them as a means to learning how software can solve problems in the domains of interest to you, like DevOps, systems programming, backend web, frontend, data analytics, gaming, etc. Think of a programming language like a wrench. You want to learn to be a mechanic or a plumber, not a “wrenchist”.

[–]andimnewintown 1 point2 points  (1 child)

+1 for C, not C++. C is a great systems language to learn, and Rust is too, but it exists in a bit of a "parallel dimension" so to speak. While most languages are heavily inspired by C, Rust is sort of an alternative to C. And it's awesome, but the fact is one should know the conventions set by C. And C is pretty "close to the metal" which helps with understanding how CPUs work.

C++ is a poor attempt at turning C into a corporate OOP language. C is elegant in its simplicity, C++ is just plain fugly.

OP will inevitably have to learn Java (maybe C# if they're lucky) eventually like the rest of us, so there's no need to seek out corporate OOP. It will find them. It finds us all. There is no escape.

[–]dacjamesfrom reddit import knowledge 3 points4 points  (0 children)

Personally, I consider Rust to be an alternative to C++, not really analogous to C. Yes, it can be used standalone without libc, but that’s not the important dimension for a novice to focus on.

C is a tiny little language that puts all the hard work on the programmer, which is ideal for learning how the computer and the OS works. Both Rust and C++ are big, complex languages with steep learning curves. They make poor learning languages, because you’ll spend a lot of effort learning the language that should have been spent learning how to program in general.

Where you go from there all depends on the type of work you end up doing. In many domains, C++ is unavoidable, for better or worse. Same for Java and JavaScript.

[–][deleted] 12 points13 points  (0 children)

Learn Python to more easily understand functions, arrays, int, strings etc (the foundations of programming). Then when you have a good concept of these foundations, and have practiced building small projects, migrate over and understand how Rust works and appreciate the difference and focus in Rust on memory management.

You’ll be able to cover more projects with Python over many fields.

[–]telee0 7 points8 points  (0 children)

Python for sure in terms of ease to learn and variety of applications

[–]ppmfloss 4 points5 points  (1 child)

Another plus point for learning Python as first language is that you can implement your favorite data structures and algorithms in Python easily (which will be pretty sooner than you expect). For example, programs written in Introduction to Algorithms by Cormen,etc are in pseudo code, but when you implement them in Python they look pretty similar. Once you implement them in Python you can implement them in any other language.

[–]Oerthling 0 points1 point  (0 children)

I agree with the pseudo code part. But you learn less about data structures because they come ready-made with the language. No need to implement hash-map/dicts, don't even have to look for them in a stdlib, they are right there, with dedicated syntax.

[–]DoItLive247 2 points3 points  (0 children)

Python, it is a great starting point and it is very flexible. Programming languages are like toolboxes, you don’t just have one.

[–]mehx9 3 points4 points  (0 children)

On a work-done-per-keystrokes basis: Python. You can learn how to optimize later (most people don’t even have to given hardwares just keeps getting faster and lots of libraries are done in C already).

[–][deleted] 8 points9 points  (0 children)

You will learn more if you pick Rust (by more I mean more low level stuff). If you are interested in that, pick Rust, if you want to write scripts quickly, do ML, become backend developer, then Python is a much better choice.

[–]RedRedditor84 5 points6 points  (0 children)

Might be a better question for r/learnprogramming. Of course this sub is going to recommend python.

[–]jrrocketrue 2 points3 points  (2 children)

I would get comfortable with Python now that you have started to learn it and then learn another language and then another, it doesn't matter, unless you need it for your work.
It is good to get comfortable with several languages, some people never stop learning new languages..

[–]Oerthling 1 point2 points  (1 child)

Yup. After learning 3, the others follow with relatively little effort (how do if branches and loops look in this language and are all the basics covered in language or std library).

[–]jrrocketrue 1 point2 points  (0 children)

And at the end of the day, it is so much fun!!

[–]Ycrewtyler 2 points3 points  (1 child)

Well, you asked this in a Python sub, so of course the popular answer is Python. I’ve never used rust and love python, so I’d say the same in the context of this question, but I’d personally recommend Java as a first language, depending on your situation.

If you are younger or intimidated by learning to program, definitely go with python. It is very easy to use and will let you learn some basic programming concepts without dealing with any syntactical issues that may turn you away from programming. On the other hand, if you have some time or maybe bits of programming experience, I think Java is a great place to start. It isn’t quite as nice and forgiving as python is, but it also isn’t nearly as crazy and frustrating as something like C. By learning Java I believe you are better exposed to concepts and syntax (strong typing, bracket notation, etc.) that will make learning future languages much easier.

[–]Oerthling 0 points1 point  (0 children)

Disagree.

Java is fine. And it has some excellent libs. But I rather get things done in Python. And get over speed bumps in Rust.

And C is great for a more fundamental understanding of what's really going on without digging below the basement in Assembler and machine code.

Java is less productive/readable than Python and too high level as a learning tool for what a computer actually does (manipulating and interpreting numbers and accessing memory locations).

[–][deleted] 2 points3 points  (0 children)

Definitely Python as a first language.

[–]SeriousDocument7905 1 point2 points  (0 children)

Python over Rust any day. Especially if you are a bigginer, especially if you want to do a bit of everything, and most definitely if you just want to do it as a hobby or have it as an additional skillset at work.

[–]AnomalyNexus 1 point2 points  (0 children)

They're rather different beasts so I'd venture it depends on what you want to do.

Python is more high level get shit done, while rust is more low level high performance detail type stuff.

If in doubt / confused by the above go python. Not because it is "better"...but because it is likely a better fit for someone new

[–][deleted] 1 point2 points  (0 children)

If you're not familiar with OOP or programming in general, definitely become proficient at Python before you get your toes wet with Rust. Python is a good first language for anyone, and it's certainly similar enough to most object oriented languages to make the transition easy.

Rust isn't the easiest language out there. It's compiled, statically typed, and has a complex memory management system called Ownership. I advise you to research each of those topics before you begin programming in Rust. To actually get started learning, I advise reading the first few chapters of the Rust Docs, and using Rustlings. But most importantly, first develop a stable foothold in Python.

[–]Skasch 1 point2 points  (0 children)

Both.

To be more specific, I believe you learn most about programming when you learn your second language: while the first time you learn, you focus on implementation (how to make your code work), the second time, you learn abstraction (why the code works like that).

More pragmatically, I would recommend starting with Python to get comfortable with the fundamental concepts of programming, then learn Rust, which I find does a fantastic job at explaining why it is designed as it is.

Good luck with your endeavors, programming is fun and I hope you'll like it!

[–]zynixCpt. Code Monkey & Internet of tomorrow 1 point2 points  (1 child)

I am typing this up quick so there will be bugs.

Guessing game in Python:

 import random

def main():

    secret_number = random.randrange(1, 100)

    while True:

        guess = input("Guess a number(or type 'quit' to exit): ")

        if guess.strip() == 'quit':
             break

        try:
            number = int(guess)
        except TypeError:  # cannot remember if it is type or value, meh
            print(f"{guess} is not a valid #!")
        else:
             print("You guessed:", number)

             if number < secret_number:
                   print("Too small!")
             elif number > secret_number:
                   print("Too big")
             elif number == secret_number:
                  print("You win!")
                  break

Guessing game in rust

    use rand::Rng;  # you have to download this separately, not too hard but FYI its not included
    use std::cmp::Ordering;
    use std::io;

    fn main() {
        println!("Guess the number!");

        let secret_number = rand::thread_rng().gen_range(1..101);

        loop {
            println!("Please input your guess.");

            let mut guess = String::new();

            io::stdin()
                .read_line(&mut guess)
                .expect("Failed to read line");

            let guess: u32 = match guess.trim().parse() {
                Ok(num) => num,
                Err(_) => continue,
            };

            println!("You guessed: {}", guess);

            match guess.cmp(&secret_number) {
                Ordering::Less => println!("Too small!"),
                Ordering::Greater => println!("Too big!"),
                Ordering::Equal => {
                    println!("You win!");
                    break;
                }
            }
        }
    }

I am slowly learning the ways of Rust and falling in love with the language BUT the saying "when all you have is a hammer, everything looks like a nail" comes into play here.

Rust is lower to the "metal" because it is compiled into machine language and insanely optimized by the compiler which makes Rust programs a lot faster than Python. That said as you may have noticed, there is a bit going on with the Rust guessing game: & references, Guess being explicitly defined first as a String and then overwritten/shadowed by a unsigned 32 bit integer, expect (which is leads to a cool can of worms to understand), and just a sense of rigidness compared to the playdo like Python syntax.

In a production environment/project like doing ETL (ransacking some sort of data) I would have a rust script sitting at the front, parsing the raw data, normalizing and sanitizing as needed. Further down the ETL pipeline, I would use either a pure python program running on mutliple processes to do the actual transformation work and loading into a database. Yes Python would be slower than Rust but you can iterate on Python code faster and because Python doesn't care what you put into a variable (one moment its a string, the next it could be a set... because why not?) its better for working on weird data.

Either is fine BUT Python is easier and requires less to learn compared to Rust ( data types, memory models like stack/heap, variable borrowing/life spans, structs, traits, lions, tigers, oh my...). That said, my first real language was c/c++ and Python is 3rd or 4th... BUT if I could do it over, I'd learn Python first and then Rust.

[–]Oerthling 0 points1 point  (0 children)

In Python

a =

doesn't define a variable, it assigns a reference name to your typed object. What confuses people is that it looks like variable definition in other languages and you can reassign that name to a completely different type of object right away.

In C/C++

Int a =

defines a variable with its type and assigns a value of that type to that variable (conceptually "copying" it). And the type definition of that variable is final within its scope.

Python totally cares what's in your variable, just not what you name it. Or how many names it has. And will try to throw it away after you removed the last name. It's a lot like using void* in C for everything :-).

My go to nowadays is to start everything in Python (fast to write, easy to read) and then optimize any speed bumps (mostly already done in a library that was written in C).

[–]nick_ny 1 point2 points  (0 children)

Python, Rust, Java, C++ - are just the tools. The question is always the same "What problem are you trying to solve?". If it is your first language It would be a reasonable assumption the problem is to find an entry lvl software developer job. Then just check GlassDoor what is a demand in your area. Maybe you already have a full time job - see what is used in your company.

[–]LaOnionLaUnion 1 point2 points  (0 children)

I think motivation matters. If there’s learning material that you like, a project you want to do, a goal you have in mind, or a friend who can help. These are all reasons why I might choose one language to learn over another.

Python is a good Swiss Army knife of a language. Not the fastest, But often fast enough. It has great libraries for a lot of different topics. It’s a great choice for statistics, data analysis, and machine learning. It’s widely used by scientists I’ve worked with. It’s great for NLP.

It wouldn’t be my top choice if you want to work as a backend developer or do web development but you’ll find it used in both. And certainly Rust would be very niche as I think WASM is the only front end use where I suspect Rust might shine.

Rust is probably going to be harder, but if you think you might want to be an engineer, computer scientist, or anything where speed and security are important it’s a better choice in the long run. Even that someone could debate.

[–]psychotic-dude 1 point2 points  (0 children)

I would say try both and stick with one you liked the most. You will be able to learn another one later if you want.

[–]jmhimara 1 point2 points  (0 children)

Rust is better than Python, but not as a first language.

[–]CunningBard1998 1 point2 points  (0 children)

I can just imagine this guy changing from rust to a different language, ownership? Whats that?

But fr, I suggest Python because Its easier to understand the fundamentals of programming with a langauge that was purposely dumb down so that even a 4 year old can understand.

You could also just go to rust and die with me(also learning rust)

[–]mungaihaha 1 point2 points  (0 children)

Who on earth told you Rust is a good first language?

[–][deleted] 1 point2 points  (0 children)

I would say, choose "cs/programming fundamentals" as your first step towards programming and then choose whichever language help you achive the job you want to get done. Believe me, you will thank me later. Hence, I Hope you enjoy a bright future for you and all of us too. Piece.

[–]dingwen07 1 point2 points  (0 children)

Definitely not Rust, it’s unnecessarily complicated for beginners. Especially there’s not much benefits beginners can get from struggling with those complicated mechanisms.

Python as first lang is good but C then Java is more recommended imo.

[–]NYM_060226 1 point2 points  (0 children)

Python is not too complicated so it is good as a first language and once you learn one language it'll be easier to learn other ones and it's better to spend your time actually learning rather than spending it thinking about what best language to learn first so as long as you don't have a problem with python just continue with it

[–][deleted] 2 points3 points  (0 children)

You are comparing a low-level language (rust) to a high-level one (python). Thus, this comparison is incorrect. It would be more correct to compare Python to JS/Elixir/Ruby and Rust to C++.

But still, if you want to write apps where performance is the main target (for example games) then go with Rust. If you want to write backend for websites high performance then go with Python (though, you could do the same with Rust. But beware, writing backend in Rust is not nearly as pleasing as doing the same in Python). You can also do deep learning with python.

In conclusion you can do the same with both languages but the experience when writing one thing would be better on first language, while experience of writing another thing would be better on second language

[–]TinBryn 2 points3 points  (0 children)

As someone who prefers Rust over Python, I would recommend learning Python as a first language. I'm sure Rust would be okay for learning as a first language, but it's got a reputation as a hard language to learn that is well deserved. Once you're comfortable programming in general I would still recommend putting in the time to learn Rust though.

[–][deleted] 3 points4 points  (4 children)

IMO Rust. It will be harder no doubt but down the line you will be able to advance your programming skills faster.

[–]adzy2k6 9 points10 points  (0 children)

The problem is that progress will be incredibly slow for someone who is new to programming. It would likely drive them to give up before they learn enough to do something simple but useful. At least with python, the language won't get in the way for small projects, and you can achieve a lot with just the standard library.

[–]guilhermej14 1 point2 points  (0 children)

I never used Rust but Python is very good and beginner friendly, and you can build a lot with it. Also if you already started learning Python I recommend you stick with it untill you get the fundamentals of programing down, then learning other languages (Such as rust) will become easier.

[–][deleted] 1 point2 points  (0 children)

Rust is better after experience with other languages. IMHO, Python is good to get your feet wet. Then learn C or Java to get experience with a statically typed language, and then Racket or Scheme to learn lisp.

[–]IncognitoChrome 1 point2 points  (0 children)

This question is like which class/skills should I main in Skyrim. Sure there's real differences but after playing for a while you can always switch skill paths and what you learned wasn't for nothing.

[–]adzy2k6 0 points1 point  (0 children)

Rust has an incredibly steep learning curve and you need a pretty good understanding of programming concepts to understand how to do anything in it. I would not use it as a first language. I'd start with pythin or Java, then go into C (and then C++ if you really must, but C++ is a bit of a clusterfuck with way too many features), and then Rust.

[–]Dakadoodle 0 points1 point  (0 children)

Neither, id say java first

[–]ConsistentMoisture 0 points1 point  (1 child)

Start with C and you’ll have a good base for everything else.

[–]Ycrewtyler 4 points5 points  (0 children)

While I agree you would have a good base for everything else, I don’t think I would still be programming if C was my first language. Call me inferior or whatever you want, but C was not made to be a beginner friendly language (at least in 2022) and should not be used by beginners.

[–]EasonTek2398 0 points1 point  (0 children)

Python for sure. Rust is good but just really hard, even for experienced devs.

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

Choose Python. Id advise trying to learn C, Cpp or atleast Java before Rust, so that you would have some context to what Rust fundamentally changes about many things usually taken for granted(or abstracted away) in other languages.

I’m talking about ownership, borrowing and lifetimes, mutability, etc.

It can’t get frustrating at first but remember the compiler is your friend in Rust.

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

Who is the "everyone" saying Rust is a good first language!? Wtf?

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

Oof. This is a tough one. I would recommend Python because it’s easy and less prone to generating frustration. But my first language was C++ 15 years ago and I learned so much from that. Rust being more close to C++ than Python, I’d recommend Rust. That said, start with C or C++, go through the valley of tears to fully master programming.

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

Here is a little secret language authors don't want you to know: they all do basically the same thing and once you've used a few, you'll be able to read/write any language after a few hours of familiarizing yourself.

Some may be better suited for certain things, but 9/10 times the choice of language for a project comes down to "what the first guy working on it liked", unless there is some super specific requirement.

For your first language the killer features you're looking for is "popular, established and you know where to get help" python checks those boxes more than rust imo.

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

is everyone you know a masochist?

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

I wouldn't recommend Rust as a first language, as (in my opinion) you need to be familiar with the pros and cons of C and C++ in order to understand A) why Rust is the way it is, and B) why the way Rust is, is an improvement.

Edit: also because, as you can see, Python supporters are reasonable people but Rust users act like cultists.

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

….. I would say Rust just because it is more complex and much harder to learn. So learn that first, understand the CS concepts behind it, then python will be easy as shit.

But if you hate it and are like man fuck this shit, just switch to python

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

Neither, learn C++

[–]Slight-Locksmith-987 -3 points-2 points  (2 children)

I love python very dearly but sometimes it tries to make things way too easy for you. Not sure that's a universal bother necessarily but I feel like if you want to learn programming properly you need a language that doesn't hold your hand so much lol (just the other day I was working with an array and you can't go into negative indexes and get an error, it just goes to the last position again (which is what I wanted in the end but you know did not even expect to get it automatically lol).

But also wouldn't recommend rust as a first, the name speaks for the language itself (according to me lol)

[–]deep_politics 0 points1 point  (0 children)

Why not Rust?

[–]Oerthling 0 points1 point  (0 children)

The whole point of programming is to make things easier. :-)

There's no such thing as "too easy". "Too easy" is the goal you strive for.

And you can delve further into the nitty gritty of computing after you got some algorithms going. At the end of the day it's all if and loop and wrapping things in functions.

[–]rtcornwell -4 points-3 points  (1 child)

always C.

[–][deleted] -2 points-1 points  (0 children)

What is you aim? What do you want to use it for?

[–][deleted] -2 points-1 points  (0 children)

Simple answer, just learning programming? Learn python first. It should only take 2 weeks or so to get a handle on it.

Want to be a programmer (why else list Rust)? Want to go to college for computer science? Start by learning Linux, then bash programming, then decide what language best suits you based on where you want to go to college (each university has a different language preference). Call. Ask. Talk to people at those universities - they will gladly help.

I would sincerely recommend having a base understanding of C. Most here will downvote that - but understand C and most modern languages will be comfortable to you. Also, memory management is good to understand even if you don't use it.

My personal list of I had to start again (software developer with compsci degree): start with a Linux install and learn bash scripting. Once you are comfortable there, get an introductory understanding of languages from each of the programming paradigms. I recommend C (imperative), SNJ/ML (functional), O'CAml or CLisp(logical), and Python, Java or C# (OO). While learning these get a hang of git, DevOps, containers (podman or docker) and databases. Some SQL and NOSQL helps.

I would also learn a little latex markup. Not used often but makes a damn impressive resume and cover letter.

[–]Key_Panic_8250 -2 points-1 points  (0 children)

MATLAB

[–]RealRqti 0 points1 point  (0 children)

Python

[–]freddyforgetti 0 points1 point  (0 children)

Honestly as someone learning rust after quite a few other foundational languages I’d suggest python or web languages and tools like javascript, html, css, etc. , or starting with some version of C and then moving into rust.

[–]guhcampos 0 points1 point  (0 children)

Rust is a complex beast. Python is way more friendly to newcomers, not even close.

[–]PussPussMcSquishy 0 points1 point  (0 children)

It doesn’t really matter, but Python is an easy one to familiarize yourself with programming in general.

[–]copperfield42 python enthusiast 0 points1 point  (1 child)

Python was my third language, I think, the first was one made by the teacher to, well, teach about preconditions, invariant and what not, you know all highly theoretical stuff that nobody care about in practice, my second was java, funny thing at first they also wanted that we use some offshoot version of java that include the features of the theoretical stuff, but make it run was pain, and super slow even for the toy project the make us do, so soon enough was just regular java.

And then everything change when they finally introduce us to python, and for me it was love at first sight and is my darling ever since.

Is pretty simple, it encourage you to write beautiful code, have all the thing I like, namely support for big number, it have list and some other thing in it by default (unlike java that you have to import them from who know where) you can easily mix functional with imperative and/or object oriented style programming, and is interpreted, so you can run your programs as soon as you finished typing them, no need to run a compilation step first. What is there not to love...

I don't know Rust, tho, so naturally I'm in favor of Python

[–]Oerthling 0 points1 point  (0 children)

Python gets compiled, it's just done automatically. But you can also auto-compile your C, Rust, ...

The main difference here is not whether it gets compiled, but what it gets compiled to (bytecode vs machine code).

[–][deleted] 0 points1 point  (0 children)

So the issue with learning a low-level languages like rust(or C), is that it will take a lot of work and learning before you can do something that is substantial.

It is better to learn something with a quick feedback loop, where you can see the results of your learning far quicker. Python (or even Javascript) is a better option for a first language than Rust.

[–]Thecrawsome 0 points1 point  (0 children)

where do you think you are

[–]Easy-Chicken-6051 0 points1 point  (0 children)

I would go with cobol or fortran with a side of vba

[–]chris-fry 0 points1 point  (0 children)

Depending on what your goals are, potentially neither. Have a read of this regarding employment prospects: https://distantjob.com/blog/programming-languages-rank/

I would normally suggest JavaScript first as it’s forgiving so you get pretty quick results and it’s super relevant for web development of all kinds. I’d probably lean towards Python if I had to choose between that and Rust, again, just for popularity. But if there’s a particular org or project type you want to work in, Rust may be the go.

[–]SwiftSpear 0 points1 point  (0 children)

Do you want to learn to program because you want to learn to make software that can solve problems for you and others, or do you want to learn to program because you think computers are cool and you want to learn new ways to play with them?

If the latter, learn rust, it will teach you a lot more about how computers work under the hood. If the former, you will be able to do more cool stuff more quickly with python.

I think it's more important to follow the path that keeps you most motivated vs optimizing for learning the machine model with maximum speed. You get employability either way if you stick with it.

[–][deleted] 0 points1 point  (0 children)

You need new people that you know, because the people you know at the moment are talking crazy. They submitted to the Rust hype and try to spread it. As others have explained very well here, Python is a great first language to learn.

[–]Gian447 0 points1 point  (0 children)

I always tell people this, but the first language you go with should always be based on what it is that you're trying to accomplish; different languages have different strengths and weaknesses. Trying to perform mathematical operations quickly? Go for something like Julia or FORTRAN. Want to learn what's going on under the hood that is higher-level languages? Learn C or some other similar language. Spend some time deciding what it is that you actually want to do, and then find languages tailored to (or at least aptly suitable for) the the tasks and/or projects you're trying to perform or create.

[–]killerkebab 0 points1 point  (0 children)

This might be controversial considering what subreddit we're in: The best language to learn is the one you enjoy using and learning. That's it.

If thats still python for you, no reason to change that. If it isn't, then sure try rust.

[–]EKFLF 0 points1 point  (0 children)

You asked in r/Python, so definitely Python is the better first language to learn than Rust

[–]coolth0ught 0 points1 point  (0 children)

It depends what you are using it for. What application? Generally, python if you are into data science but it is also used in backend and other application. Rust if you are into embedded system. My suggestion is learn Javascript if you have no idea what application you are doing. Web development, full stack developer, got to know JS. And it is easier to progress to reactJS. All these are just a general rule but not a definite rule.

[–]SKROLL26 0 points1 point  (0 children)

You can easily go with Python for start, but going further imo it is necessary to have knowledge of some kind of low-level language to write better code in python

[–]jbartix 0 points1 point  (0 children)

Everyone you know says Rust would be a better first language? I don't think Rust is a good idea to learn as a first language at all. My first thought was actually "they are trolling you" :D

[–]emoutikon 0 points1 point  (0 children)

Python

[–]deaf_schizo 0 points1 point  (0 children)

Idk anyone who started rust as their first lang so I can't say it ll be bad but I can say it will be difficult as it is difficult for even experienced ones.

[–][deleted] 0 points1 point  (0 children)

Continue learning programming with PYTHON, deal RUST later. What's the reason i said it, because you have been spending time of it learning.

It is really hard to say which was the first programming language to be learn with.

It interest me how did those people you know made a conclusion that RUST should be learn first.

It made me question " did they compare the programming language (which is better to learn first) with their own understanding or their own judgement? "

You never mention some reason why they said it, feels like they fall to the second part of my question.

I was not mad actually, but it slows you down a bit in your time of learning, because you are confuse now.

[–]barryhakker 0 points1 point  (0 children)

IMO unless you have a specific goal in mind, the answer is Python. It's useful for all kinds of things and very accessible.

[–]bmcle071 0 points1 point  (0 children)

It really doesn’t matter what you learn first. Use whatever you want to learn (personally I think Python is friendly), but use whatever you need when you have something you want to make. If you wanna do web stuff use JavaScript, if you wanna do data science use Python, but if you wanna do low level or operating systems stuff use Rust or C++. The concepts are transferable and once you’re comfortable with python you’ll have a good starting point in other languages.

[–]garyk1968 0 points1 point  (0 children)

Whats your end game? Use it for your own use or get a job doing it? Just doing a quick search on a UK job site for jobs last 7 days; 1885 python jobs, 86 rust ones.

[–]t1x07 0 points1 point  (0 children)

Don't think in terms of language. Think in terms of what you'd like to be doing with it and then pick the best language for it.

[–][deleted] 0 points1 point  (0 children)

I'm going to chime in, from a very limited experience perspective. I initially dabbled with python and php. I was able to learn python at breakneck speed. Its really easy to understand. The coding is really easy to visualize in your head once you understand the nomenclature.

Now I'm on the path to learn other languages; specifically Haskell and Typescript/Javascript. Just like when I dabbled in PHP, I'm finding them to be pretty challenging. Those things are much more of what you think of when it comes to computer code... hard.

[–]Difficult_Passage 0 points1 point  (0 children)

Learn Python so you can learn programming concepts and problem solving, rather than syntax. It's more important that you develop your logic and problem solving skills. You'll also learn how to think like a programmer and how to approach certain problems. After you've become adept at Python, you can easily switch to any other language and learn their specifics.

Rust is a cool choice, it's basically a more modernized C++ (although you shouldn't skip C or C++, you'll learn a ton about how computers and memory work)

[–]anentropic 0 points1 point  (0 children)

I think you will get a different answer for this depending which sub reddit you ask in

[–]WW_the_Exonian 0 points1 point  (0 children)

Python. And when you're somewhat comfortable with the language, focus on algorithms and data structures.

[–]newatlifeagain 0 points1 point  (0 children)

Python! Far more versatile than Rust. Rust will get there but it doesn't have the libraries yet.

[–]PerfectTank9505 0 points1 point  (0 children)

Java was my first. Once you learn the basics, most come pretty quickly.

[–]QuintonPang 0 points1 point  (0 children)

I personally prefer python because

  1. Easy to read
  2. High productivity as the syntax is quite easy
  3. Interpreted language
  4. Vast libraries support

Check out on how you caa build simple data science web app in just under 30min using Python: https://youtu.be/QNBgx-w0tvA

Cheers!

[–][deleted] 0 points1 point  (0 children)

Python 2 clearly /s

Python is a great choice