Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

571–580 of 856 posts

Re: Ask HN: Why did Python win?

#571

Earlier quoted context omitted.

C++ and Python are not competitors. Sure both are Turing complete so you can implement anything in either. However if you should is a different question. Python is very difficult to maintain when you program goes over 100k lines of code, while the static type system of c++ is good for millions. C++ compiles to fast binary code, while Python is typically 60x slower for logic (though often Python calls a fast algorithm…

As a person who uses C++, I must say something that also applies, somewhat, to Java. We have all the cool kids like Kotlin, Rust, etc. However, when it is about finishing a project, beating C++ or Java ecosystems is almost impossible. Besides that, C++ has improved a lot over time. It still has its warts and knives but you can code very reasonable C++ with a few guidelines and there are also linters, and -Wall -Wextr…

> However, when it is about finishing a project, beating C++ or Java ecosystems is almost impossible.

Yet, somehow people do this with python, perl, and ruby. Google hires professional python people too.

Re: Ask HN: Why did Python win?

#572

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 should be one-- and preferably only one --obvious way to do it. This is so hilariously wrong in python though

That was then. Python does much much less explicitly anymore these days, either.

Re: Ask HN: Why did Python win?

#573
For me, it was python available on the base Linux install at work. Along with Bottle.py it meant my team could build internal web apps and host them without asking IT for additional software installs like apache.

If ruby had been there with a ruby micro framework available we might have used that.

Re: Ask HN: Why did Python win?

#574

Earlier quoted context omitted.

The amount of complexity that Rust adds is not worth in most scenarios in my opinion. I can think of Rust as something for OS with critical safety or so. Besides that, in real life you end up having C in most of your software, so I am not sure how Rust behaves compared to well-written C++ with all warnings and linters on and using smart pointers. But my hypothesis is that they do not stay very far apart in safety. Th…

All this may be true (I'm not the strongest C++ developer in the world, relatively limited exposure), however the Rust memory management via the type system feels natural once you wrap your head around it. That idea is really good. I always hated dealing with `delete`, `free` and `malloc`. Being able to offload all that busy work to the type system is just nice. There are definitely ergonomic improvements that could…

> however the Rust memory management via the type system feels natural once you wrap your head around it

It disallows many valid patterns. That is why I recommend to take a look at Hylo programming language (before called Val lang) to see what I think it is a very good example of how to make a language safe without making the learning curve so steep and without a need for a GC.

Re: Ask HN: Why did Python win?

#575
Python is much older than Ruby in terms of wide adoption.

Python became popular because: if you want to write a program that runs from the shell, uses file I/O, terminal I/O and possibly network I/O, that's quick and easy to work with, and where the runtime is either already on your computer or can be installed painlessly, there weren't many alternatives.

Shell script is too crappy a programming environment for anything non-trivial. Perl is a mess. Ruby isn't on the machine and is (still!) a nightmare to install. Compiled languages are not quick and easy to work with. JS doesn't exist yet (in a form usable from the shell). Tcl is too niche.

Python is the least worse choice.

All the stuff about ML and stats and Jupyter and what not is not relevant -- that came later as a consequence of Python already being popular.

It's actually amazing that Python is still popular because it nearly shot its own feet off with the 3.0 nonsense. Most folks here probably don't even remember that...

Re: Ask HN: Why did Python win?

#576
Ruby was popular by accident. Rails was popular because it was valuable.

Rails was ahead of it's time. The alternatives in that era were ... well, they aren't around any more. Rails was to the alternatives what an iPhone is to a flip phone.

Python is useful with a low barrier to entry. It's valuable and available. It isn't competing with anything. It's useful in the way that spreadsheets are useful.

Just as databases didn't "lose" because spreadsheets are more widely used, neither Ruby nor Python has won or lost. Python is more useful in high-value areas, particularly data science. And ruby is still more fun.

Re: Ask HN: Why did Python win?

#577
post #288

Earlier quoted context omitted.

What is dispatch in this context? Function call polymorphism? Aside: I wasn't a big fan of the Mathematica language so I wrote "PyML" a looooong time ago- it turned unevaluated Python expressions into Mathematica, transmitted them via MathLink to be evaluated the Mathematica kernel, and then the results were send back and converted to a Python expression. This was long before sympy. It never went anywhere (I found wa…

Yes, function call polymorphism. Especially combined with Mathematica's piecewise syntax. I didn't really use it for numerics, it was more for Lisp/Prolog type things. I was always impressed at how short and readable the Mathematica code ended up being. I used to use Mathematica quite a bit to generate C++ functions. But it's a very different use case than Matlab. One of the things I like about python is it isn't too…

Mathematica is nothing less than a work of art. I dedicated a fair amount of time to become proficient, but it never solved the use case I had (find derivatives for complicated functions- this was before autodiff was common).

Unfortunately, Wolfram himself has made a number of decisions that greatly limited its applicability and so it will always be niche.

Re: Ask HN: Why did Python win?

#579

Earlier quoted context omitted.

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.

In your wsgi.py file, you specify which settings module to use when loading your WSGI application with, e.g., gunicorn. In your settings.py file, you can specify what your root url config is, e.g. a urls.py file which recursively defines all routes in you application. But nothing is stopping you from having n different settings files, e.g. settings/service1.py with n different urls.py files and loading them in n different wsgi.py files and serving them with n different gunicorn deployments.

You can also do things like adjust the settings defined in your settings.py file to use a different url conf programatically based on environment variables. It is just python, after all.

Re: Ask HN: Why did Python win?

#580

I started programming python in 98. It won because before that, Perl was king. Have you seen perl? Python made a great decision, it was the anti perl. One way to do things, keep the syntax easy and simple. Force whitespace indents. Before python got really "pythonic" It read like pseudo code. As someone that explored Ruby for a bit, Ruby has too much magic. Magic is cool when you're the one casting the spell, but for…

I have come around to dislike forced whitespace. I don't think non-visible characters should be syntactically important, and spaces are thus overloaded by separating both within lines and defining functions.

With linters how they are, a traditional semicolon makes things a lot more clean IMO.

Post reply on HN