Hacker News new | past | comments | ask | show | jobs | submit login

Python is great fun, and you can be really productive with it, but for people first coming into programming, a language with an explicit and strict type system is invaluable.

I used to think that everyone should be taught python first, because it lets you focus on the meat of computer science - algorithms, data manipulation, actually _doing_ something - but after helping my girlfriend out with some comp sci 101-104 projects, I really think Go, Java, or Rust should be everyone's first language. It's hard for someone new to the field to understand the nuances that come with python's corner cutting. You can work yourself into some weird corners because of how permissive the language is, where in a (strongly) typed language, the complier just says no.




I use Python a lot professionally these days, after having been a C#/Java developer for a while (and some experience with C and Free Pascal). I absolutely love the language.

I always feel a little iffy when people talk about Python like it's a language ideally suited to beginners.

Dynamic typing puts so much power in your hands to create expressive structures. But it requires discipline to use properly. It's a great trade off for me but I don't think it would be for beginners.


My reasons for suggesting Python compared to Java for example is due to the fact that I teach to Electrotechnical engineers and there are plenty of libraries to experiment with Raspberry and stuff and it's a little bit higher level than C. Every language has its own difficulty to teach but the fact the companies have a banned.h it's basically saying "well C gives you functions for C, but don't use them". It makes it unecessary harder to explain something to people with no experience.


> You can work yourself into some weird corners because of how permissive the language is, where in a (strongly) typed language, the complier just says no.

Could you share an example?


Here's one my (intro programming, non-major) students have just been tripping over this week:

  if word == "this" or "that":
      ...
Not an error, always runs. Very mysterious to a beginner. (Shared with C/C++) Another one:

  counter = "0"
  for thing in things:
      if matches(thing):
          counter += 1
The error is in the init, by someone who is overzealous with their quoting, but the error is reported, as a runtime error, on the attempted increment, which throws a TypeError and helpfully tells them "must be str, not int", and of course I know exactly why it's reporting the problem there and why it's giving that error, but it's a bit confusing to the newbie programmer and it doesn't even turn up until they actually test their code effectively, which they are also still just learning how to do.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: