Earlier quoted context omitted.
Monkey patching is a terrible practice outside of unit testing and can lead to extremely difficult to debug bugs. Also monkey patching isn't unique to python.
FWIW I tried looking a few up and standard library seemed hit-or-miss: JavaScript it didn't work: class testClass { constructor() { } callHoHe() { console.log('ho', 'he'); } } let hi = new testClass(); hi.callHoHe(); testClass.callHoHe = () => { console.log('haha'); } let heh = new testClass(); heh.callHoHe(); This ended up just printing 'ho', 'he' twice, For Java people didn't think it was possible: https://stackove…
Ask HN: How did Python become the lingua franca of ML/AI?
61–70 of 99 posts
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#62Wrapper generators and compiler tools like Cython and before that SWIG made it very easy to glue existing functionality to Python, so together with Pythons' great usability and user-friendly language it created a killer combination for productive data science & ML.
That said other languages could've pulled this off as well, Ruby for example. Python had more early traction in the scientific and high-performance computing communities though whereas Ruby was more popular in web development (due to Rails), which ultimately gave Python the edge and attracted more and more toolmakers to its ecosystem, which in turn spurred further growth. Great "IDEs" like the iPython/Juypter notebook were also a key factor in Pythons' success, as they provided a super user-friendly UI for data scientists.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#63Another way to analyze the problem: what other language would it have been, given the moment ml hit? You say compared to other scripting languages'. Let's list them. Ruby: no numeric support Go: unnecessary typing, modest numeric support, shitty generics Bash: ha ha ha Scala, java, c, cpp: not a scripting language, complex Tcl, php: out of favor Rust: hadn't happened yet R: in memory bias, not as simple Other languag…
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#64Moreover, scientists are typically so-so programmers so not having to worry about complexities like dereferencing pointers, specifying types etc, makes the language much easier to pick up.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#65In some cases you might see a 3000 line python script with no defined functions… just loops and conditionals and lots of copy-pasted code with small variations in each section.
It’s really a shame, since there are so many more elegant languages which are equally or more powerful. But python is not a terrible language… it’s just an everyman get-shit-done language. We could be worse off.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#66My last job was at an ML company. Most ML people there cannot build large robust systems and some struggled with the non-algorithmic bits of software. I am sure that some can out there in the world, but for the most part our ML people were very good at creating models and not very good at the development part, especially as the program grew (part of the motivation to hire devs like me in the first place). Python gets…
I don't think this is a fair assessment of "most ML people" Some of the biggest distributed systems built today are used for statistical inference or scientific computation Most "ML people" I know are highly versatile in software, networks and deep hardware knowledge, i.e., essentially they have a very good understanding of what a computer is and what is capable from Its very naive to think that you can assemble mach…
The tiny subset of people who build ml systems (say tensorflow core devs, write actual distributed systems, etc) are actually hpc specialists, and have all the qualities you describe.
Of course, you may work somewhere where you're lucky enough to have everyone be good at everything!
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#67Earlier quoted context omitted.
I don't think this is a fair assessment of "most ML people" Some of the biggest distributed systems built today are used for statistical inference or scientific computation Most "ML people" I know are highly versatile in software, networks and deep hardware knowledge, i.e., essentially they have a very good understanding of what a computer is and what is capable from Its very naive to think that you can assemble mach…
The most insane thing about Python is how you can override single methods in classes and use the class like normal. One time I was working on getting FIFO working on Windows, and none of the Python built-ins were set up to handle any random process writing to a named pipe that wasn't within the same Python instance. So what I did was I took the closest implementation Python offered, which was in the multiprocessing m…
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#68Another way to analyze the problem: what other language would it have been, given the moment ml hit? You say compared to other scripting languages'. Let's list them. Ruby: no numeric support Go: unnecessary typing, modest numeric support, shitty generics Bash: ha ha ha Scala, java, c, cpp: not a scripting language, complex Tcl, php: out of favor Rust: hadn't happened yet R: in memory bias, not as simple Other languag…
R is definitely a good language for quant work. In some ways it could have been the natural choice, and there are still places where it's a better choice than Python. It's just far to fragmented, only really good for numeric work (and thus harder to integrate with production systems), and full of the weirdest gotchas. https://www.burns-stat.com/pages/Tutor/R_inferno.pdf
I found it easy to jump from the software side of things to the data side of things because I already knew the quirks and tricks of Python. Having to learn a new language would have made this transition harder.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#69It also works fairly well cross platform. That means you can develop on Windows and run on Linux without too many issues (at least for ML/AI stuff, common frameworks usually have per platform binaries published)
i.e. Python is familiar to the people supporting production systems
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#70Another way to analyze the problem: what other language would it have been, given the moment ml hit? You say compared to other scripting languages'. Let's list them. Ruby: no numeric support Go: unnecessary typing, modest numeric support, shitty generics Bash: ha ha ha Scala, java, c, cpp: not a scripting language, complex Tcl, php: out of favor Rust: hadn't happened yet R: in memory bias, not as simple Other languag…
Non ML/AI coder here: Why does ML/AI work need to be written in a scripting language? Why can’t it be something like C++ etc instead?
ML also needs reverse autodifferentiation, which would be a real pain in C++.