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
Ask HN: Why did Python win?
531–540 of 856 posts
Re: Ask HN: Why did Python win?
#532Earlier 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.
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?
#533I'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?
#534I 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?
#535Earlier 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.
Re: Ask HN: Why did Python win?
#536Earlier 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.)
Re: Ask HN: Why did Python win?
#537Earlier 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…
[0] https://www.r-consortium.org/blog/2022/03/16/update-successf...
Re: Ask HN: Why did Python win?
#538Python'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?"
Re: Ask HN: Why did Python win?
#539Re: Ask HN: Why did Python win?
#540Earlier 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 ?