TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What about Python makes it popular for ML?

9 pointsby ccajasover 6 years ago
I don't have experience with Python, but from my only superficial point of view I don't see it much more powerful or flexible as a VHLL than, say, Ruby or Perl. What made Python the high level language of choice for machine learning? Was there just a couple influencers at the industry that decided to build ML libraries for it because Python is already a familiar language to them? Would the language choice been immaterial if they were working with a different high-level language?

4 comments

eesmithover 6 years ago
My two bits. A bit pedagogical, so apologies for covering things you might already know.<p>Python effectively started in the early 1990s. Perl was the hot new language for &quot;scripting&quot;, but Perl 4 was lousy as an embedded language and didn&#x27;t support extensions. This was fixed in Perl 5, which also made it possible to do complex data structures. I think early on the extension mechanism was also Unix-centric, and require a Makefile?<p>Tcl was amazingly easy to embed and extend. It was designed with that in mind. It wasn&#x27;t so good at complex data structures. OO programming was an add-on, with several different available extensions. I also recall some problems with garbage collection of extension objects ... it&#x27;s been a while.<p>Python was possible to embed, and easy to extend. It had support for more complex data types. It was a better fit than Perl 4 or Tcl for 2D and higher arrays. As such, it was picked up by the more numerically oriented developers, who used Python to, using the popular phrase from then, &#x27;steer&#x27; computationally intensive jobs.<p>Python-the-language also changed to make it easier to support multi-dimensional array indexing, specifically for numerical computing.<p>(Perl at the time was very popular in bioinformatics, which at that time involved a lot of RE-style pattern matching, a lot of format munging, and a lot of making different pieces work together - things that Perl excels at. But not numerical computing.)<p>As a result, Python had several iterations of Numeric&#x2F;numarray&#x2F;NumPy while Perl, Ruby, and Tcl - languages which were used more by non-numeric subfields - did not.<p>Then came the web. First Zope, and later Django, helped make Python a popular language for web development. The easy extension mechanism made it easy to add all sorts of C extension modules.<p>And Fortran extension. And R extensions through adapters.<p>A lot of the early ML code was written in C, C++, Fortran, or R. The natural solution is to put the data into a NumPy array, pass it via some bindings to the other language, and continue to work with it in Python.<p>I don&#x27;t think Perl and Ruby had the same level of numeric support + extensions, making it more difficult. Python got critical mass, and continued to grow.<p>People have been doing machine learning with Python since the 1990s. I can&#x27;t think of who the &quot;couple influencers&quot; might be.
jimnotgymover 6 years ago
1) Libraries: scikit-learn, Pandas, numpy, make it easy to work with data.<p>2) Easy to learn but powerful, lots of examples online, lots of good books, great community.<p>3) IPython&#x2F;Jupyter workbooks make it really easy to work through a solution and share it.
评论 #18773598 未加载
lordCarbonFiberover 6 years ago
The huge thing for python is it&#x27;s ability to call out to lower level (faster) languages. From a machine learning point of view the ability to stuff data in to buffers cheaply to be consumed by C&#x2F;fortran is what&#x27;s important (all of those fancy math and data science libraries do the heavy lifting in c&#x2F;fortran).<p><a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-3118&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-3118&#x2F;</a> for more of how this was accomplished to get a bigger picture of the story.
srinathkrishnaover 6 years ago
Simplicity is one of the main traits of Python. It’s conducive to prototyping and GTD in a quick fashion. Libraries like scikit and pytorch have also helped developers build larger solutions using smaller building blocks without worrying too much about implementations.<p>Python suffers from serious performance constraints nevertheless and productionizing an ML service that requires real-time analysis is going to take some effort. For such systems, folks usually tend to lean towards a hybrid stack.