Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because people in that game value simplicity of use over anything else (performance, safety, maintenance) and Python is a top performer in that KPI while Java is not very good at this (though it is getting better but still)


This is a big part of it. People who are scientists write code that we would think is disgusting and don’t care that much about abstraction outside of mathematical functions. There’s a lot to learn with Java. I helped classmates in my intro to programming class when I went to college, because I already knew how to code, and I have no idea why they picked that language as an introduction language. After weeks people were still struggling because on top of the ideas like loops/variables/control flow now they are having to learn classes.

Python was written with people like scientists in mind. Professionals write fast C libraries and then people who know just enough to get by use python to glue it all together.


> Python was written with people like scientists in mind.

Having just taught a bunch of scientists Python, I'm skeptical of this.

Stuff that is obvious to me, but really hard to explain to coding beginners:

* why `len(list)` but `str.join(...)`? I.e. why are there two ways to call functions?

* why does `[]` do so many different things? List comprehensions, list construction, subsetting, sometimes it secretly calls a method....

* why in the name of god is the first row called 0?

* and then why does [0:3] mean rows 1, 2 and 3, not rows 0, 1, 2, 3 or 1, 2, 3, 4?

* ... except in pandas where sometimes [foo:bar] includes bar...

* in general, why is pandas so damn complex?

I thought it'd be easier to teach than R, but I'm not quite so certain now.


> People who are scientists write code that we would think is disgusting and don’t care that much about abstraction outside of mathematical functions.

- plenty of scientists write good code; I think the "scientist can't code" meme is harmful.

- most of the people that write PyTorch code aren't necessarily scientists - they're software developers (data scientists, ML engineers, research engineers, whatever title - but their main job is to write code)

> Python was written with people like scientists in mind.

Python had nothing to do with scientists when it started. It was written to be readable and easy to use and it started as a hobby project. It existed for over 15 years until the data science / ML ecosystem started growing around it.


I'd flip that meme slightly; it is true that scientists write shitty code...but it turns out computer scientists do exactly the same, and with less humility.


The difference is programmers write shitty abstractions to abstract shitty code


I should have been more clear, I didn’t mean python was written for scientists I meant it was designed with simpler syntax so people can pick it up and write a script in a few hours, scientists need to do some simple algorithm so they use python instead of fighting with a language with more terse syntax. People wrote their math libraries for python because it was a simple language (on the surface) with a C api. It was at the right place at the right time.




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

Search: