Python's a lingua franca in AI/NN because it was already a dominant language in scientific computing. Its dominance in scientific computing grew steadily through the 1990s and 2000s, for a few reasons: 1) Python -- specifically CPython -- made it easy to wrap existing, thoroughly tested high performance libraries in Python APIs. So, you got easy access to things like GSL and BLAS and LAPACK, but you get to call numpy…
Ask HN: How did Python become the lingua franca of ML/AI?
41–50 of 99 posts
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#42It is used as a shell. It's merely an interface to some gigantic, highly optimized libraries (numpy, scipy, and later, Tensorflow, Pytorch, etc.), and it does a very decent job at being an interface.
- The language is easy to grasp, at least the part that is used in data science and ML;
- The syntax is "familiar", as compared with R;
- There are many more general purpose libraries in Python than in R;
- There's no memory management problems;
- The standard library is packed with batteries;
- No compiling, which is important for being a shell;
- It's better than bash etc. at dealing with non-text data, especially numerical values;
- The community was already writing extensions in C;
Some other language could work well, too, had someone written a numpy for it at the time. But there really aren't that many people who are capable, interested, and invested enough to write such a marvelous library.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#43For the curious, our primary hammer was “ROOT” https://root.cern - note its well-evolved ability to connect Python and C++ code.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#44Another 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?
NumPy is highly optimized for things like matrix math. You get great speed with the C-level module, and you drive it with really simple Python code. So you want to multiply two matrices? The code literally looks no different than multiplying two scalars. That's Python's superpower.
I haven't written C++ in nearly 20 years; maybe it's good enough to be able to do ML work. But the heavy lifting library in C/C++ plus the high-level driving Python is a really good fit.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#45Earlier quoted context omitted.
I left out JavaScript. It is not a simple language, with it's service heritage. It is bound up in the node runtime in a way that doesn't really work right for data processing.
lol, you forgot perl too.
Partially joking, but not totally, and I can appreciate why people might say this: https://news.ycombinator.com/item?id=5725291
(I pasted the HN link because the original seems to be down)
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#46Python's a lingua franca in AI/NN because it was already a dominant language in scientific computing. Its dominance in scientific computing grew steadily through the 1990s and 2000s, for a few reasons: 1) Python -- specifically CPython -- made it easy to wrap existing, thoroughly tested high performance libraries in Python APIs. So, you got easy access to things like GSL and BLAS and LAPACK, but you get to call numpy…
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#47The tl;dr: Python had the advantage of a mature legacy in supercomputing doing many of the same types of computations done in AI/ML. Those libraries and bindings provided a massive leg up versus other scripting languages that did not have this kind of capability effectively built-in.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#48Python's a lingua franca in AI/NN because it was already a dominant language in scientific computing. Its dominance in scientific computing grew steadily through the 1990s and 2000s, for a few reasons: 1) Python -- specifically CPython -- made it easy to wrap existing, thoroughly tested high performance libraries in Python APIs. So, you got easy access to things like GSL and BLAS and LAPACK, but you get to call numpy…
Can you link any source on the python scientific usage in the 90s and early 2000s? I think the dominant language in science at that time was a mishmash of MATLAB, Java, C++, FORTRAN and Perl (In Biology at least, perl was the goto glue language due to its excellent string processing capabilities)
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#49Earlier quoted context omitted.
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…
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.
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://stackoverflow.com/questions/47006118/is-there-any-wa...
For Java they said here that you just have to use your own similar implementation.
And for C# they have some pretty intense restrictions on overriding standard library stuff:
https://stackoverflow.com/questions/21302768/where-we-can-ov...
Golang doesn't seem to have this functionality as well:
https://stackoverflow.com/questions/37079225/golang-monkey-p...
Ps. it would have been nice to have monkey patching when dealing with btoa and atob in JavaScript, since they have different function on NodeJS vs the browser.