Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

271–280 of 856 posts

Re: Ask HN: Why did Python win?

#271
having used both ruby and python extensively, my guess is that what gave python an edge is better support for namespacing and stricter adherence to local scoping. it is far easier to read a largish python project and easily see where every symbol the code uses is defined; ruby makes it a lot harder because by default everything is tossed into one big top-level namespace and imported implicitly.

concrete example:

python:

    foo.py:
      def f():
        ...

    bar.py:
      import foo
      x = foo.f()  # very clear where f comes from, just look up foo.py
ruby:

    foo.rb
      def f
        ...

    bar.rb
      require 'foo'
      x = f  # grep through the code if you want to know what f is

Re: Ask HN: Why did Python win?

#272

What concepts does a language force a new user to be aware of, and how reliable are user's first intuitions about those concepts? I would argue that Python dominates Ruby in this metric. New users wonder how to call functions. They form an intuition ("use parenthesis"), but it's unreliable. "Oh, parenthesis are optional--oh, parenthesis are only optional sometimes". New users wonder what a function is exactly. They f…

>New users wonder how to call functions. They form an intuition ("use parenthesis"), but it's unreliable. "Oh, parenthesis are optional--oh, parenthesis are only optional sometimes". print f"are you {sure} you need parenthesis to call a function in python" >Python is much more boring in this respect, users are more likely to form accurate intuitions. is defining a class the same as defining a function? What about fun…

Double underscores are ugly, but not surprising or frustrating. I say they are not frustrating because the language doesn't force beginners to be aware of how they work right away. Double-underscore methods are there for people to seek out when they're ready, but the language and the surrounding community doesn't push people into comprehending them. Intuition is good enough for a long time. Ruby has more focus on metaprogramming which is likely to force users into some pretty complicated stuff before they're ready.

print as a statement is inconsistent and surprising, but the explanation is shallow--they made an exception for print, that's all there is to it. It's not beautiful but it is unlikely to cause a 2 hour debugging session.

Re: Ask HN: Why did Python win?

#273
post #69

python does many things well ruby does one thing very well So apparently the "do one thing well" thingy doesn't always hold

ruby does a lot of things well - it is still the best language i've found for quickly exploring a problem in code, or prototyping a solution. i'm less happy with the experience of maintaining a large codebase in it but only because i've found other languages that have much better support for that.

Re: Ask HN: Why did Python win?

#274

Python ended up 'specializing' in data contexts, thanks to Numpy / Pandas, and as a result, ended up becoming the first exposure to programming than anyone doing data stuff had. That was millions of people. In that space, it had no competitors. Ruby ended up 'specializing' in web dev, because of Rails. But when Node and React came out, Ruby on Rails had to compete with Nodejs + React / MERN as a way of building a web…

I agree with these as major points. A few other secondary ones

Ruby was primarily maintained in Japanese, so had a barrier to entry for language level issues. It also lacked english-language evangelists and university presence.

When Ruby was new (invented 1995) Python had some older design issues (as it was 6 years older) however it really recovered and implemented a lot of change through Python 2 (2000) and python 3 (2008). Though there were compatability issues in the short term in the long term this change worked out.

Ruby inherited from perl TIMTOWTDI (there is more than one way to do it) philosophy which is a little more at odds with the scientific community

Re: Ask HN: Why did Python win?

#275

Python ended up 'specializing' in data contexts, thanks to Numpy / Pandas, and as a result, ended up becoming the first exposure to programming than anyone doing data stuff had. That was millions of people. In that space, it had no competitors. Ruby ended up 'specializing' in web dev, because of Rails. But when Node and React came out, Ruby on Rails had to compete with Nodejs + React / MERN as a way of building a web…

> In that space, it had no competitors. Well, there's R. But basically, yes that's the long and short of it.

Or Julia, a language custom designed for data science.

Also, MatLab was the go-to before Python took over the scene. So it definetely has competitors.

Python's strength is that it is the "jack of all trades" language. Its not the best at anything but its pretty good at everything.

Re: Ask HN: Why did Python win?

#277

What concepts does a language force a new user to be aware of, and how reliable are user's first intuitions about those concepts? I would argue that Python dominates Ruby in this metric. New users wonder how to call functions. They form an intuition ("use parenthesis"), but it's unreliable. "Oh, parenthesis are optional--oh, parenthesis are only optional sometimes". New users wonder what a function is exactly. They f…

It is sad to me that you hate Ruby. It is a better language than Python for my taste in all dimensions except number of libraries available.

To begin with I could never understand why there need to be those global functions in Python to do meaningful things with lists.

In Ruby the "everything is an object" really works down to every nut and bolt and is clean and very conceptually pleasing.

Whether you call a package a gem, module, jar or whatever isn't very central.

Re: Ask HN: Why did Python win?

#278

Earlier quoted context omitted.

Yeah, there's the ongoing Perl joke about writing a script that works today, but not understanding how it works tomorrow. Too much one-liner type stuff that did not allow for maintainability

That’s any code I haven’t looked at for a while, to be honest. I can’t count how many times I’ve looked at code I wrote or bug tickets I fixed and have absolutely no memory of doing it. It’s almost like the act of committing flushes the local storage in my brain.

Perl is different as people really tried to do this on purpose with maximizing the concept of one liners. Maybe it's a PTSD kind of an effect? "Any" code or good code doesn't try to be developed in a way that is difficult to parse by the next person. Perl developers definitely didn't adhere to the policy of writing code like the person maintaining it is a serial killer that picks people that write unmaintainable code and they know where you live.

Re: Ask HN: Why did Python win?

#279

Python ended up 'specializing' in data contexts, thanks to Numpy / Pandas, and as a result, ended up becoming the first exposure to programming than anyone doing data stuff had. That was millions of people. In that space, it had no competitors. Ruby ended up 'specializing' in web dev, because of Rails. But when Node and React came out, Ruby on Rails had to compete with Nodejs + React / MERN as a way of building a web…

As a Python programmer in the 2.x days, I think data science happened fortuitously to counteract the exodus over the 2->3 transition. For a long time, it felt to me like python was on the way out because of the changes.

Re: Ask HN: Why did Python win?

#280
post #73

Earlier quoted context omitted.

I've heard so many people say that Ruby is really easy to pick up and work with and for some reason I've had the exact opposite experience. I have tried to learn Ruby at least three or four times and I bounce off it every time. There are a bunch of other languages that I've learned and worked with effectively, but for some reason my brain just refuses to grok Ruby.

That's word for word my experience with Go. I wonder if people are different enough that programming languages cannot be one sized fits all?

Experience between people differs. Problems they want to focus on differ. The environment changes.

Maybe in hundred years or so software development will somewhat settle, but just look at something trivial like a hammer ... there are so many different kinds and some have their favorite brand.

Post reply on HN