Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

831–840 of 856 posts

Re: Ask HN: Why did Python win?

#831
I like to say that Python is the keyboard of programming languages.

These days, we have so many different ways to input data and commands into a computer: multi-touchscreens, digital pens, even voice recognition -- however, the huble old keyboard still rules, even on thouchscreens. The reason for that is that you will be able to use a keyboard even if you have never encountered it before; you will be slow and make many errors, but as long as you know your letter you will be able to input text. At the same time, someone with extensive training and/on experience in using a keyboard can be incredibly efficient, inputting hundreds of characters per minute with minimal mistakes.

Python is in many ways like that: it's much easier to get you started with programming, not requiring cremembering complex symbols or syntax. At the same time, and experienced Python programmer will be able to write extremely complex software quickly, even if sometimes it will be somewhat slower than the equivalent in another language. And if you're _really_ experienced, you could even build performance-critical parts of your program in another, faster language while still maintaining the Python-based higher level.

Re: Ask HN: Why did Python win?

#832
post #800

Earlier quoted context omitted.

> 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. It's difficult to have this discussion in any sane way when Rust (or C) comes up. I tried Rust, but I have projects to deliver on strict timelines and I have yet to find a client who is prepared to pay me for the (what I found to be) very large onramp time to gain…

What makes you choose Go over C#/Java for medium projects? And why not go for the large projects?

> What makes you choose Go over C#/Java for medium projects?

Because I said:

>> C# and Java are also getting a bit too complicated for my tastes too.

I abhor complications.

> And why not go for the large projects?

Because I said:

>> where I work with others, C# and Java seem to hit the sweet spot

Yeah yeah, I know it sounds like I am whining (Maybe I am :-), but at least I am complaining about all of them.

Java and C# do appear to have been battle-tested for very large projects that aren't microservices.

Go? I dunno. I've only ever seen very large projects in Go using microservices. I like its simplicity.

My main complaint is that programming languages have too much minutiae to track that I really shouldn't have to be tracking.

Take, for example, asynchronous builtins:

Why are all the explanations wrapped in jargon that only an expert in the language would grok immediately? Promises? Futures? You gotta explain those, with examples, before you can explain what to do with a value from an async call. Go look at the popular introductions to async (say, on MDN for js, or Microsoft for C#, etc) and count how many times they have to explain something because of their leaky abstraction implementation rather than explaining the concept.

How about simply saying "calling async functions only schedules the function for later execution, it doesn't execute it".

That naturally leads into "So you need to check if it is finished using an identifier to identify which scheduled call you want to check"...

Which itself naturally leads to "The identifier you need was given to you when you scheduled the call"...

Which leads to "Using that identifier from `id = foo();`, you wait for the result like this: `result = id.wait()`".

You can even add "You can return that id, or pass it around so some other code can do `id.wait()`".

Now they don't explain it this way, because their implementation(s) is more of a leaky abstraction exposing irrelevant information about the compiler, than of a straightforward implementation of the concept. They are unable to separate the concept from their implementation.

The common implementation of async is so counterintuitive that they have to explain their particular implementation instead of the concept, because it has almost nothing to do with the concept. If they just explained the concept, programmers would still be confused because the implementation needs things like colored functions just to work poorly.

The concept of scheduled functions (which may return once, or may yield multiple times before returning), which is a simple path to understanding asynchronous calls, is completely divorced from the implementation which will produce errors like "cannot call asynchronous function from a top level"[1] or "cannot call await in a function not declared as async".[2]

So, yeah, I'm kinda upset at how programming has evolved over the years (I wrote my first program in 1986, so had a good seat for the later part of this particular movie), from "simple and straightforward", to "complex for complexities sake".

[1] Why? Because their abstraction is an abstraction of their implementation, and not an abstraction of asynchronous calls.

[2] Se [1] above.

Re: Ask HN: Why did Python win?

#833

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

[dead]

Re: Ask HN: Why did Python win?

#834
post #726

Earlier quoted context omitted.

Perl's actually excellent at processing unstructured data, and it had a strong foothold in bioinformatics for a time. I don't think the decision was as obvious as it looks.

This is true. Bioinformatics was full of Perl scripts for a variety of (text) analyses. I however remember well that many students began to hate it soon after working with it, as it was very difficult to understand existing code. So, when given a choice, many choose Python as an alternative. And stayed with it.

For most people the thing that is hard to understand about Perl scripts is the regexp code. However, regexps looks more or less the same in any language. But, the thing is, most Perl scripts process things such as log files and similar data. Which makes the scripts highly dependent on regexps, hence hard to read and maintain. The same thing goes for any code that uses a lot of regexps.

Actual Perl code, disregarding regexp, certainly isn't anymore difficult to comprehend than code in most other languages.

Re: Ask HN: Why did Python win?

#835
"Why Python" by Eric Raymond in Linux Journal is what started my love of python for me before Ruby or JavaScript outside of the browser were even a thing.

https://www.linuxjournal.com/article/3882

A python script easily outperformed a bash shell script + shell commands for processing text and automating tasks.

Most Linux system administration with Python is just so much easier than any other way, that was after I tried doing the same with Perl which was awful in terms of readbility just a few days after the script was written.

Re: Ask HN: Why did Python win?

#837
post #703

Earlier quoted context omitted.

OK, I get it, but when I'm trying to write automation for a shop that isn't natively Python-savvy (long story short, it made sense when I started a side project which evolved), if I use that library and ever move on, I now have to document in comments or somewhere WTF "BeautifulSoup" means. Because of some rando's inside joke they thought was funny.

This is actually one reason I prefer the Ruby ecosystem — whimsy is still welcome. The world has enough Noun Manager projects.

When I'm trying to figure out how to build a side project for my team and simultaneously fighting company bureaucracy who reflexively stonewalls things on the order of "no one's done that before, we need permission," I don't also want to deal with some immature idiot's stupid namespace. I want a damned Noun Manager for my own sanity's sake.

Re: Ask HN: Why did Python win?

#838

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…

Python doesn’t compare to R for analytical work — it doesn’t have the eco-system and R is specialised for it.

Where Python broke in was machine learning which is not analytical work and often involves lots of general purpose programming. sklearn, skimage, opencv, Tensorflow, Torch, JAX, and so on are often used in a general code base. Torch was actually a C++/Lua framework initially before switching to C++/Python.

Python has a dominant general purpose eco-system. It’s also a simple language to learn compared to R/Matlab/etc which are just horrible to use for data structures or paradigms other than vector/matrix based pipelines.

Re: Ask HN: Why did Python win?

#839
post #43

Readability. The most important thing for code is to be comprehensible by developers. Python has several factors contributing to readability. White space as syntax is the most obvious thing. More than that, unlike Perl which has more than one way to do things Python tends to have one or maybe two canonical ways of accomplishing common tasks. This makes it easier to navigate code without having much experience. Python…

I agree the language is very readable overall but I find the whitespace based syntax less readable and practical compared to just using curly braces. Editors can color matching pairs, let me jump between start and end of a scope, select all lines between two braces etc and all that just doesn't work in Python. Also I find it more difficult to see where a scope ends. It has upsides too and is not a huge deal but I oft…

Try turning on indentation guides in your editor, they help to visualize scope.

If you are moving around large blocks often, well maybe they are too big? There are linters that can help with that kind of thing.

Re: Ask HN: Why did Python win?

#840
post #68

Earlier quoted context omitted.

> When I first encountered Python, it was as an alternative to Perl. Me too I am amazed that Python won out against Perl Perl is much easier to use. Does not have the incredibly irritating treatment of whitespace Perl was a disrupter, whereas Python was "computer sciencey". A false dichotomy but it really mattered to people

Some people (me included) LOVED the whitespace-as-a-feature. I had swam through too many scripts where everything (regardless of nesting level) was all on the first character of a line or otherwise spaced randomly where my first step was to properly indent just to understand what it was doing. A language that enforced that was a Godsend.

“masterstoke” was the term I used when I discovered it.
Post reply on HN