Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

711–720 of 856 posts

Re: Ask HN: Why did Python win?

#712
post #525

Earlier quoted context omitted.

That was my experience. I like Perl. I'm comfortable with Perl. And after about a day of Python, I never wrote another line of new Perl code. There were so many "it can't possibly be that easy, but it is!" moments. Let's write a function to add five to a number: def add_five(num): return num + 5 OK. So, can I pass that function as an argument to another function? def call(func, value): return func(value) call(add_fiv…

If that blew you away you really should try Ruby: def call(fn, val) = fn.(val) call(->(n){ n + 5 }, 10)

It is still hard to understand unless you are familiar with the language. Python got popular because it made it simple.

Ruby on the other hand encouraged cleverness like what you wrote.

I think ruby faded for the same reason perl did. It is cool to write code, but once it's time to maintain it, especially after the rock star who wrote it left, it sucks.

Re: Ask HN: Why did Python win?

#713
Ten years ago, Python used to be excellent as a second choice for everything. So if you dabbled in machine learning, web, statistical analysis, text processing, system scripting, computer algebra, etc, it made sense to learn some Python even if your main job was in something else.

So it grew a critical mass of people who know Python but not for the sake of Python itself, but for something else. And suddenly these people are invested. They want more, better, and faster. And then the demand pulls the proposition, and a decade later, Python is a big thing.

I work in applied geometry. Numpy is good. Pandas is of little relevance for what I do. But what became a gamechanger is Numba. It's a run-time compiler that brings Python into native code for the target architecture, Inter, ARM, or even NVidia GPGPU.

We used to do research in Python, invent algorithms there, and then rewrite them in C++ "for performance". The last time we did that, C++ version became 3 times as slow as the Python one when translated literally. We hid the fact by rewriting the algorithm itself, but that was the last straw. We now run Python in the cloud directly, and it rebuilds the native code for every piece of hardware we procure for the task automatically and I think this is beautiful.

Re: Ask HN: Why did Python win?

#714

Earlier quoted context omitted.

I would just add that for scientific scripting Julia is usually nicer to program in than the combo of numpy and Python. Julia is fast enough on its own that you can do the matrix calculations directly and it supports real mathematic matrix operators. It’s also a great type based design that makes using packages magical.

I think Julia has a hard uphill battle against the "Python is the second best language for anything" effect. Julia looks pretty cool to me, but I already know Python. I'll probably learn more about it in my spare time, but I'm also never going to be able to convince my coworkers to try it out, because they also know Python and that's good enough for them. And thus Python's dominance continues.

I was able to convince my coworkers to stop working on a Python project (a simulator for a scientific instrument) once we all realised that we would have not been able to keep using plain Python because of performance. When the alternatives where (1) to force everybody to learn either C or Fortran, or (2) to rewrite everything in Julia, they asked me to provide examples of both solutions. After I showed them a few different approaches (pybind, cbind, f2py...), there was full consensus for Julia. We moved what we implemented so far (it was not to much, luckily), and so far nobody has regretted the choice.

The problem in using two languages is that you do not have just to learn a new language besides Python. You have also to figure out how to properly interface them. (f2py was considered the easiest solution, but we feared that the 1- vs 0-based array indexing would have likely caused many bugs.)

Re: Ask HN: Why did Python win?

#715

[flagged]

You are not asking for help. The comments on your critique are patient, and explain how to look at things different. Just because people disagree, does not mean they 'attack's you.

Honestly, your critiques seem more like opinions. The comments are pretty spot on that these are not issues. Your perspective on the default data types is off though. This is not an attack. I simply disagree with you descriptions and opinions.

Re: Ask HN: Why did Python win?

#716
post #710

Earlier quoted context omitted.

So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition to Perl's vigorous advocacy of More Than One Way. Python has been really winning for some time, so it's natural that its ideological discipline has grown ragged. The crop of kids who value options above consistency don't have the scars of the Perl age to infor…

I think Python has some of the worst API documentation I’ve ever read. Even Java puts it to shame and that is sad

Coming to Python from PHP it was interesting to see that in the PHP world I'd get 80% of my knowledge from the PHP documentation and 20% elsewhere. In the Python world it's easily the other way around. It also doesn't help that the PHP documentation is more up to date so I am using the most current info, while for Python their own docs are so bad I rely on other docs but they all vary on what version of Python it depends on and whether it follows current best practice. The difference is night and day and one of the reason I ended up going back to PHP.

Re: Ask HN: Why did Python win?

#717
post #283

Earlier quoted context omitted.

A lot of Rubyists are turned off by Python because there are just too many ugly things and exceptions in Python.

100% fair. They're probably right; certainly right from their own subjective view, which is what matters. I'll also note that the OP focused on how "fun" Ruby was. Ruby is beautiful and fun. Going back to the original question: why did Python grow more than Ruby? My first answer was going to be a rhetorical question: which beautiful and fun language has been the most successful? C isn't especially beautiful or fun, n…

Python had a huge head start. It was already one of the most used scripting languages by the late 90s and Ruby barely even existed outside of Japan.

Ruby’s beginner-friendliness and consistent OO design managed to help it expand in the early aughts and Rails brought the language to prominence in 2005, but by that time Python was already replacing Perl in its niche and had support from giants like Google.

Ruby got more adoption than would have been predicted based on its late entrance and lack of truly differentiating features, and that’s a credit to its ergonomics, community and how easy it is to learn.

Re: Ask HN: Why did Python win?

#718
post #668

Earlier quoted context omitted.

But it is absolutely unintuitive why it shouldn't be if mylist.length > 10

If the length of mylist ... see how length comes first? Only unintuitive if you never spoke English or other european languages.

This construction is something my French friend often does in English instead of using a possessive—the of .

As a native speaker of English, I’d just say, “if mylist’s length is more than 10”.

Re: Ask HN: Why did Python win?

#719

[flagged]

I've checked the article and the comments are awesome, not sure what you're talking about. People disagree with you, respectfully, explaining why they think you're wrong. What did you expect from the "welcoming" community, ignoring the critique?

Re: Ask HN: Why did Python win?

#720

Earlier quoted context omitted.

> There should be one-- and preferably only one --obvious way to do it. This is so hilariously wrong in python though

So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition to Perl's vigorous advocacy of More Than One Way. Python has been really winning for some time, so it's natural that its ideological discipline has grown ragged. The crop of kids who value options above consistency don't have the scars of the Perl age to infor…

> There should be one-- and preferably only one --obvious way to do it.

I just wish Python applied this approach to package management. It is needlessly complicated.

Post reply on HN