Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

821–830 of 856 posts

Re: Ask HN: Why did Python win?

#821
post #19

Coming from Perl, I love Ruby (for non-Rails stuff), but end up using Python because: - The documentation in the Python ecosystem is generally better. - There's more Python libraries, and they're generally better maintained and better documented. - Python has a better interface to C. - Python is more popular and generally more supported by third parties. - Django/Flask - There is comparatively little Ruby activity ou…

I also had a hard time choosing between Python and Ruby for my goto scripting language. But given Python community is more active outside of webdev, I also chose to stick to be more professional on Python.

Re: Ask HN: Why did Python win?

#822

The way I (somewhat hazily) remember it, Python was mainly competing with Perl as a scripting language, not Ruby as an application/web language. I started hearing about Ruby years later when Ruby on Rails drove the Web 2.0 movement, but that feels like a different era to me. Eric S. Raymond wrote an article[1] in 2000 about his experience trying Python after spending a lot of time with Perl. I'll quote some of it her…

The quotation is so true. There was a "Python WTFs" posted recently which was fun but the thing is you could work with Python successfully for years without ever running into them. Contrast that with other languages where you need to learn the WTFs before you can stop writing buggy code.

That list of python WTFs was mostly stuff where I was going WTF at the code before even looking what the result was. Stuff like having a try/except with a return in the except block and the finally block.

Re: Ask HN: Why did Python win?

#823
The first time I tried Ruby was before Rails and I was quite astonished how much easier/more consistent it was to use than e.g. Perl. At that point I (and probably most people) considered it a scripting language, and used it for toying around and backup scripts. Eventually I also did Web development with it. It turned out Ruby's package management was quite hard to tame. Maybe not even more difficult than Python's today but at the time there was no RVM or any other virtualenv equivalent. (Or for that matter people who wrote their own.) Then after 1.8.7 there was the quite buggy and incompatible 1.9 which took away momentum, worsened the packaging situation to the point that 2 year old projects wouldn't work any more. (Some gems even disappeared!) I think that pretty much killed it.

FWIW Ruby's FFI is pretty advanced and when you interface it from C it feels like duck typed C. Also back then I struggled writing a hello world in Python, so I think it's bad luck. On the other hand I think the Ruby community changed Software development quite a lot, making it more welcoming and defining how Web development should be done.

Re: Ask HN: Why did Python win?

#824

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

Back then (in 2004) the most popular programming languages were PHP, Perl, C++ and Java. Java was pretty focused (and even then, there was the distinction between int and Integer, between []int and ArrayList, etc.) but C++ and (especially) Perl were driving people crazy because there were thousands of ways to do the same thing. And nobody had any respect for PHP's design so let's not even talk about that one.

Re: Ask HN: Why did Python win?

#825

Earlier quoted context omitted.

The one thing Rust is getting right that I hope Carbon et. al take from it is using the type system to manage memory. not having to explicitly remember `free` in safe Rust code is amazing. Knowing that if my types are sound that memory will be managed reasonably is great. I also think that immutable by default, mutable by explicit declaration is pretty great. I do think there is a lot of room to add better ergonomics…

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…

> 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.

Can C++ compilers + linters reliably detect all misuses of unique_ptr? Because that sounds like a halting-problem kind of problem, and as soon as you can't guarantee memory-safety, you're definitely not in the same ballpark in terms of safety. I mean, memory-unsafety is the number one vulnerability cause in software. C++ has many qualities, but safety certainly isn't one of them.

Re: Ask HN: Why did Python win?

#826

Earlier quoted context omitted.

Doesn’t seem like that big of a deal. You’re going to have a really hard time getting your first test to pass if you make a mistake. I don’t mean using testing as a poor man’s type system, I mean even the tests you would write in a statically typed language will quickly uncover any mistakes you could possibly make there.

In statically typed systems, this wouldn't even compile. I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.

> In statically typed systems, this wouldn't even compile.

Still, it's not like you're going to miss that a function doesn't return something expected. Even in statically typed languages you are going to have tests to validate that much.

> I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.

That's another problem entirely. Although even then it would be pretty hard for an errant type to not blow up your tests. Again, not tests specifically meant to check that your types or sane, just the same tests you would write in a statically typed language.

Re: Ask HN: Why did Python win?

#827
I had these general impressions as a guy who started out with PHP who didn't know much at the time:

Python really presented itself as a general purpose language for me. For example, as a language that could do a lot of the general scripting that you could do with Bash could but using a language that is much, much easier to read. Even though I can write it better now and appreciate how much faster it runs, at the time I had a really hard time writing and understanding Bash scripts.

Ruby on the other hand, almost seemed as a language you had to learn as a pre-requisite to get to use Ruby on Rails. But if you did not care about Rails, then there was little incentive to learn it. Since I already used PHP for the web and had lots of experience with its respective frameworks (like Symfony) I did not feel the need to double up on a web language / framework combo.

And, yes I know it is used in other frameworks/software but the perception that I had at the time was that Rails was the most popular use case for it.

But then when Python really solidified itself for me as the truly general purpose language was seeing it as the language behind projects like Pandas, Numpy and Ansible for example and being able to use that software no problem.

And all this in spite of the fact how readable both of them were and the fact they both have great package managers.

So all those things being equal I chose to learn Python because it seemed like I get more out of it beyond web development.

I will say this about Rails though, Ruby on Rails is one of the most influential web frameworks of all time and Laravel borrowed so much from it.

Re: Ask HN: Why did Python win?

#828
post #66

There's a joke that is roughly "Python is not the best language for any particular task, but is nearly always the second best language for that task" - it's a jack of all trades language. Because of this, lots of people learned Python, and then applied it in many different areas, and it just became more prevalent and useful.

Definitely a jack of all trades language.

And when you get older, and you care more about solving problems than about trying new things, and you've got more responsibilities in life and lack the time to devote to learning new language / technology du jour, then knowing and using Python becomes so handy.

If it is indeed the 2nd best language for the job, it is still a decent choice if you get to solve the problem.

Re: Ask HN: Why did Python win?

#829

Earlier quoted context omitted.

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

A really, really bad argument in my opinion. That thinking would lead us to Cobol.

A really, really bad reply imho—see how useful that is?
Post reply on HN