Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

531–540 of 856 posts

Re: Ask HN: Why did Python win?

#531

Earlier quoted context omitted.

I think Python was popular as a general-purpose language first. After all, there was a reason people put so much effort into writing Numpy in the first place. I think a lot of people were attracted to the language design, as captured in the Zen of Python ( https://peps.python.org/pep-0020/ ), such as: Explicit is better than implicit. Readability counts. Errors should never pass silently (unless explicitly silenced)…

There are just too many ways to do things in Ruby. How many forms for an if-else or for loopin can you name in Ruby? Just as the simplest example. Monkeypatching is also awful for readability. Explicit imports are way more readable than things appearing into current namespace implicit kind of stuff like it happens with Ruby

Two: `for` and `each`. Most people use `each`.

Re: Ask HN: Why did Python win?

#532
post #284

Earlier quoted context omitted.

> Python is not the best language for any particular task Python basically solved this problem by wrapping around C code that's far more performant, but still exceptionally simple to leverage due to python's simple syntax. LlamaCpp has C++ in its name, yet its most popular platform is python. So for certain applications, python because the undisputed #1. Because it was C in disguise, with better usability. With paral…

> Python basically solved this problem by wrapping around C code I would rather call it a work-around. Having to switch to a vastly different language to get halfway decent performance is hardly a good solution. It's not a rare thing in normal applications that you need to have some routine fast and there's no pre-built C solution for it.

Maybe so, but it's not like there are a lot of languages around that are as expressive, flexible and easy to learn as python, but as fast as C.

JS is probably the closest, but not because of superior language design -- people with money wanted it to be faster, so it is.

Also, the choice is not just python, or writing a module in C -- there's numba and cython, various python compilers, pypy and cffi.

Re: Ask HN: Why did Python win?

#533
Reading the comments makes me wonder why where perception of Ruby that it is complex or hard to learn is coming from. Let's talk about just language without external libraries, package management or context of specific software.

I'm using both Ruby and Python for tooling (so there is neither Web nor ML context. Neither meta-programming). When it comes to Ruby I learn one thing and safely extrapolate, i.e. you don't need to learn all of the language to be able to use it. With Python I've had to come to the docs many times to understand how a particular thing works and I keep finding ways to shoot in my foot. This includes very basic stuff like variable scoping (global, class, instance or local) or type non-obvious type conversion (in Ruby only nil and false are treated as false in conditional expressions, while in Python this includes empty string, empty list, empty dictionary and so on).

When it comes to readability in Ruby it is natural to do data processing by "pipelining", e.g. you don't need to do f1(f2(f3(f4(data)))) (which is often the case in Python) and instead you can do data.f1.f2.f3.f4 which is easier to read. Classes, objects, inheritance work and feel a lot more obvious. Ruby allows to be concise without sacrificing (for example "a = 5 if seta == true"). Overall Ruby allows to write more readable code than Python.

Re: Ask HN: Why did Python win?

#534
Disclaimer: Pythonista

I had an opportunity to be exposed to Python and Ruby at roughly the same time.

Python the IPython notebook had started showing up, and the dust had settled a bit on the Py2 -> Py3 transition. So while I was working on a Python 2 codebase, the general vibe of the community was "let's not break more stuff". Pseudocode -> Python translations were pretty straightforward.

Ruby, the entry point was Rails. I bought books on Rails, could not for the life of me figure out how files got noticed by the project or not. I wanted to do something like passing in a function, went on an IRC channel, got yelled at for not doing things the "Ruby" way. Lots of "clever" methods on objects that were neat but didn't really look like pseudo code.

My experience was deeply coupled with Rails, and I think in an alternate universe where I was using Ruby for scripting I would have come out with a different feeling. But Python mostly had no blocking issues for me (a person who was programming for a while at that point), and Ruby was a bit of an undecipherable thing from an operational perspective (even if I could look at a code fragment and understand how it worked).

Re: Ask HN: Why did Python win?

#535
post #174

Earlier quoted context omitted.

I would dispute that. I always felt Rails was used by a very communicative subset of web developers while the Django users just contracted, delivered, got paid and moved on to the next project without any hassle.

I can confirm. A lot of Django apps out there. People don't make a big scene about it, and it quietly powers a lot of websites. I think one of the powers it has that no one talks about is that you can do microservices within a monolith.

I would like to hear more about this paradigm if you have a minute.

Re: Ask HN: Why did Python win?

#536
post #428

Earlier quoted context omitted.

I can't imagine Python's welcoming community has anything to do with it. If anything it was Ruby that had a reputation for being the most welcoming community with its MINASWAN (cringe) philosophy.

I'm genuinely curious: what's "cringe" about MINASWAN? (I write mostly Python these days, but have been involved in both communities for a long time, and MINASWAN never particularly stood out to me other than as a cute reminder to be nice.)

It was meant tongue in cheek as I was defending Ruby being the most welcoming community. It's just a bit twee like the voice-over on London Underground - "See it, say it, sorted".

Re: Ask HN: Why did Python win?

#537
post #224

Earlier quoted context omitted.

R is great when your data is already together in one place and homogenous/processed. In that instance the workflow using dplyr/ggplot is better. R the language is hot garbage though, and the libraries available for doing random things that aren't working with certain data structures, doing math or plotting are generally much worse than their python equivalents. That is the reason python dominates data engineering, an…

R will still have a solid place in industrial pharma for a long time (even as python growths, R growth will continue. R is pretty tightly intertwined with the process of processing and submitting data from clinical trials to the FDA, much to SAS's chagrin. Personally I think we have to accept that R, Python, Java, C++, and Go are going to be with us for the rest of our lives. I would expect PHP, Ruby, and Perl to go…

Are you from the future? R is making progress to replacing SAS in pharma, but has a long ways to go. Here is an article from last year[0] patting themselves on the back for making a R submission to the FDA. There are oodles of existing processes where data has to be formatted just so because that is how SAS does it. Nobody wants to rip up and re-validate that code until they must.

[0] https://www.r-consortium.org/blog/2022/03/16/update-successf...

Re: Ask HN: Why did Python win?

#538
post #89

Python's old as dirt; it even predates Linux: https://en.wikipedia.org/wiki/History_of_Python Sometimes the key to success is to just be adequate for a really long time.

> just be adequate for a really long time. Seems to be working for Pepsi, and their killer model of "they don't have Coke, is Pepsi okay?"

I'll have the Khao Khalash, thanks.

Re: Ask HN: Why did Python win?

#539
Python is popular because google used it. At the end of the day, the consistent thing that makes languages succeed is consistent corporate backing and money. Now, as to why Google chose it for their internal tools, we can talk about that, but if the question is why did python win, it's obviously because google made it a big part of their stack.

Re: Ask HN: Why did Python win?

#540
post #154

Earlier quoted context omitted.

numpy exists (somewhat indirectly) because matlab cost $$$. and now numpy is a far larger use of matlab's concepts than matlab will ever be. I haven't seen anything an "A-type" data scientist needs in R/SAS/SPSS that was intrinsic to the language and couldn't be ported to Python. I don't want a "data/scientific" language, or a "web" language, or a "UI" language- I want one language that explicitly supports all the us…

Well, why didn't the free alternatives to Matlab like Octave or Scilab win out then ?

Same reason people use Excel and not LibreOffice. Until you can promise 100% compatibility, users are going to run into something that breaks vs the original platform. For real business processes, the licensing cost is not worth sweating about the problem for parity.
Post reply on HN