Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

741–750 of 856 posts

Re: Ask HN: Why did Python win?

#741
post #405

Earlier quoted context omitted.

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

I've been writing Ruby daily for years and never written a `for` loop

Started Ruby in 2007 and have used it professionally essentially nonstop. I have also never written or seen a for loop. I don’t even think I could correctly guess the syntax of it.

Re: Ask HN: Why did Python win?

#742
Ruby is too fancy with weird constructs. This is why I picked Python ~20 years ago.

In ruby you can do fancy stuff like

   3.times do |i|
      print i, " "
   end
But why? Yes you save a few characters but also lose readability for people who aren't Rubyists.

The same in Python is much more readable for people with no experience in the language:

   for i in range(5):
      print(i, end=" ")
And this is a very simplified example, the complexity in understanding the Magic of Ruby goes up exponentially in real world code.

Re: Ask HN: Why did Python win?

#743
post #618

Earlier quoted context omitted.

Yeah, python 2->3 transition was painful. But, I would argue that was self inflicted. Guido and company chose not to develop a 2.8/2.9/etc series where people could move their code base over incrementally. I mean, I love python, but that sucked! Yes it would have been more work for the devs, but the amount of work it meant for the users were worse. In fact they pretty much just threw away anything before python 3.6 a…

> Guido and company chose not to develop a 2.8/2.9/etc series where people could move their code base over incrementally. That is literally what 2.7 was, as well as reimplementing some features in later p3 (up to 3.4). The core team definitely had the wrong transition model at the start, and it took some time for the community to convince them then decide on which items were the most important, but let’s not act like…

What would have been a better transition model? Are there any languages with major breaking changes that have done the upgrade smoothly?

Re: Ask HN: Why did Python win?

#744
post #400
post #366

Earlier quoted context omitted.

But Ruby took all the best bits of Perl so I'm still perplexed as to why Python "won".

Ruby did have a lot going for it about 15 years ago. Many Java/JSP people jumped ship and got on the ruby train. Ruby was a breath of fresh air comparatively. Python had a great community though, and the Python Software Foundation went out of it's way to make people feel accepted in the community. And frankly programming is often more of a social activity than most people realize -- particularly for new programmers.…

What did the PSF do to make people feel accepted?

Re: Ask HN: Why did Python win?

#745

I was there when it happened, I remember it well. Python displaced Perl, when Perl was a dominant scripting language, way back in the 1990s. What motivated people to replace Perl with Python is that we started using scripting languages for serious software with non-trivial complexity. In this context, Python was much more scalable and maintainable language than Perl, it was just an easier scripting language for softw…

> Python was much more scalable and maintainable language than Perl, This is a really excellent point. We were a Ruby/Golang shop and out of nowhere one of the sales engineers starts writing scripts in Perl. He wrote some really useful stuff, but the downside was that it was incomprehensible gobbldygook baked into 4 or 5 lines, and completely unmaintainable by anyone other than the original author. After he left we d…

Perl being write only isn't a meme, it's actual reality. It is _possible_ to write readable and elegant perl, but it requires huge amounts of skill and self control not to mush everything into essentially a 3 line regex that happens to work =)

And in for Python there is the 13th rule of the Tao of Python: "There should be one-- and preferably only one --obvious way to do it."

The language is built around pushing you to do things a certain way, it doesn't force you, but the correct way is usually the easiest and cleanest way.

Re: Ask HN: Why did Python win?

#746
post #532

Earlier quoted context omitted.

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.

> 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. There are several languages on the JVM which are that or better. As fast as C, no, but JVM is considered fast enough for a lot of applications where performance matters. > JS is probably the closest, but not because of superior language design There's this myth that Python…

>There are several languages on the JVM which are that or better. As fast as C, no...

Like what? None of the ones i know of meet the "expressive, flexible and easy to learn as python" test.

> There's this myth that Python as a language is superior to JS. In reality both have their long history and warts. JS/V8 is just much faster.

I never said anything about being better or worse, just that as far as i know there's nothing about JS which makes it much easier to optimise than python.

I'm not arguing that python is the best thing to use for everything, or that there are no faster languages; that clearly isn't the case.

The topic is "why is python popular", you're arguing that it's too slow and it's too much effort to speed up code, while I'm arguing that there are no languages which are faster, and don't give up some of the things that made python popular in the first place.

Re: Ask HN: Why did Python win?

#747

Earlier quoted context omitted.

> Guido and company chose not to develop a 2.8/2.9/etc series where people could move their code base over incrementally. That is literally what 2.7 was, as well as reimplementing some features in later p3 (up to 3.4). The core team definitely had the wrong transition model at the start, and it took some time for the community to convince them then decide on which items were the most important, but let’s not act like…

What would have been a better transition model? Are there any languages with major breaking changes that have done the upgrade smoothly?

> What would have been a better transition model?

Better supporting cross-version transition codebases.

The core team initially saw the transition as “run 2to3, fix what’s left, publish updates, P2 is gone”, but aside from 2to3 being quite limited such transition is quite hard for dependencies, as it means they leave all older dependents behind entirely (dependents which might be the primary user for e.g. company-sponsored projects), or they have to keep two different codebases in sync (which is hard), plus the limitations of pypi in terms of versions segregation.

What ended up happening instead was libraries would update to 2.7 then to cross-version codebases, this way their downstream could migrate at their leisure, a few years down the line people started dropping P2.

> Are there any languages with major breaking changes that have done the upgrade smoothly?

Some but usually statically typed languages e.g. elm’s upgrade tool worked pretty well as long as you didn’t have native modules and all your dependencies had been ported. I think the swift migrator ended up working pretty well after a while (Swift broke compatibility a lot “initially”) though I’ve less experience with that.

An alternative, again for statically typed languages more than dynamically typed ones, is to allow majorly different versions of the language to cohabit e.g. editions in Rust (Rust shares the stdlib between all editions but technically you could version the stdlib too).

Not workable for Python, not just because it doesn’t really have the tooling (it has some with the __future__ imports but nowhere near enough) but also because it changed runtime data model components specifically the entire string data model, which is not a small matter (and was by far the most difficult part of the transition, and why they piled on smaller breakages while at it really).

Re: Ask HN: Why did Python win?

#748
post #517

Earlier quoted context omitted.

Was python really ahead of shell for scripting in 1994?

I remember it as at that time Windows and Unix was the common systems. I know we collected statistics for our business software offering that could run on multiple types of Unix and on Windows. Around 1998 I think 70% of all customers choose Windows. It was easier and cheaper. So, I would say that the most common scripting language in the late 90s was VBScript. I also can't recall any of the Unix gurus at our company…

1998 was pretty different than 1994, though?

Re: Ask HN: Why did Python win?

#749
post #712
post #525

Earlier quoted context omitted.

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.

> cleverness like what you wrote.

So we should optimise languages for users who are not prepared to familiarise themselves with the language? How is this more complicated than its commonly-used Javascript equivalent?

    function call(fn, val) { return fn(val) }
    call(n => n + 5, 10)
You see when written in a language in which lambdas are first-class citizens it doesn't look clever at all so maybe Python's sad implementation of lambdas and its anti-fp culture could be at fault?

Re: Ask HN: Why did Python win?

#750
post #602
post #465

Earlier quoted context omitted.

Because the best bits of Perl were kinda trash that Python was smart to avoid.

Yeah for sure, the PERL influence is why I dislike Ruby. Makes it really hard to read if you haven't been doing it constantly.

God forbid we should have to familiarise ourselves with a language before using it.
Post reply on HN