Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

551–560 of 856 posts

Re: Ask HN: Why did Python win?

#553

Earlier quoted context omitted.

Only one of the items in your "such as" list is unique to python's philosophy, and that is "there should be one way to do it". Ruby embraces the many ways to accomplish something, it's true. However, the three others are not unique to python. Ruby especially embraces "readability counts". And I can't think of anything in the ruby language itself that is implicit over explicit. Perhaps you are thinking of rails and co…

For me, the Ruby community's comfort with monkey patching was a big turn off. In Python, you can hack around on class and replace its methods, but if you do, it's expected that your coworkers might stick you in a dunk tank and sell tickets. It's just not the thing that's done.

    For me, the Ruby community's comfort with monkey patching was a big turn off
If it helps, the Ruby community really soured on monkeypatching in general quite a while back. You don't see it much these days and every decent book or guide warns against it.

It was definitely a crazier place 10+ years ago in the early Rails days.

Re: Ask HN: Why did Python win?

#554

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…

> When you're writing working code nearly as fast as you can type and your misstep rate is near zero, it generally means you've achieved mastery of the language. But that didn't make sense, because it was still day one and I was regularly pausing to look up new language and library features! This really jives with my experience. I learned Ruby first and used it as my scripting language of choice for years, but I cons…

It goes to show how your upbringing affects these things. Before Ruby I spent a lot of time in Smalltalk which really shaped the way I thought about language and program structure, APIs, etc. I'd also spent a metric ton of time writing Perl. Jumping into Ruby was like putting on a comfortable pair of shoes.

Meanwhile Python always felt like an ill-fitting suit to me. I just personally didn't connect with the language design.

But, to each their own!

Re: Ask HN: Why did Python win?

#555
Python won by being delightful. Lots of programming languages are delightful at some stage of mastery. BASIC is delightful when you are just getting started, and JavaScript is delightful once you have a deep mastery of the language's subtleties and footguns.

Python is delightful once you get off the ground, and before you've made anything too complicated yet.

Re: Ask HN: Why did Python win?

#556
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 your audience, it's annoying if their job is to figure it out.

It offered OOP, but was like C++. It didn't force it on you. If you came from a C background, you could write C like code. If you came from an Objects/structs background you can do OOP.

It then offered a great standard library. It had a REPL. DO NOT UNDERESTIMATE THE REPL. Not just a basic REPL, but an interactive one. dir()? __docs__? The power of man pages built into the REPL, allowed one to explore an unknown library.

Say what you want, but the FFI was well thought out and embraced. This made it possible for lots of C library to be made available in Python. PyQT, wxPython, allegro, OpenGL, all these paved the way for NumPy,TensorFlow, PyTorch. Your favorite graphics, sound library and many other libraries where wrapped in Python. You didn't have to write C anymore for most people with computers being fast enough.

Python won because of many little correct decisions along the way. The python2 to python3 drama was not a nightmare like perl5 -> perl6 or VB to VB.NET. Many good little decisions with a big of luck helps.

Re: Ask HN: Why did Python win?

#557

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…

It is easy to underestimate how much Python as a language benefited from nympy, scipy, pandas and scikit-learn

Re: Ask HN: Why did Python win?

#558

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

Monkeypatching exists in both ruby and Python.

It does but it's generally considered a bad practice in Python (and many other languages) and a feature in Ruby.

Re: Ask HN: Why did Python win?

#560

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…

The REPL is huge and makes it so much easier to learn to program by trying out little snippets of code to see what they do. You can trial and error your way to a working program pretty quickly. Only Lisp has a better REPL.
Post reply on HN