Hacker News new | ask | show | jobs
by Mekkanox 3619 days ago
It was a combination of:

1) The language was created by a researcher (Guido Van Rossum) at a research facility in the Netherlands [1]

2) Network effect - as more machine learning researchers and engineers in academia used it, the need for a language that could integrate with FORTRAN with similar performance came about, which lead to NumPy, SciPy, etc.

3) The language itself is pretty simple to grasp. There's multiple ways in Ruby itself to do something, while in Python there's at most one way to do something. Anecdotal - a lot of researchers I've worked with care more about the usability and ease of adoption of a language, compared to the expressivity.

[1] https://en.wikipedia.org/wiki/Python_(programming_language)#...

1 comments

Not disagreeing with the relative simplicity of Python compared to Ruby, but the degree to which the Python community is adamant that there is always only one way to do something has always baffled me. What about `map` versus a list comprehension, or `glob` vs `os.path`? Obviously Python has pretty clear standards about what the correct way to do something in the language is, but I feel like the persistent claim that there's always exactly one way to do something can range from oversimplified, misleading, or just plain wrong.
Extreme pro-Python statements about "one way to do it" are usually made by relative newcomers who are caught up in their enthusiasm for purity. (This exuberance is natural, and is a big part of the language adoption cycle.) Extreme anti-Python statements about "one way to do it" are usually made by outsiders viewing Python through accounts given by enthusiastic newcomers. This exuberant-newcomers-vs-skeptical-outsiders dichotomy isn't representative of the actual Python culture, which is much more sensible and practical than all of this implies. If you go to PyCon and attend talks by long-time Python folks, you won't find them advocating anything like blind adherence to "one way to do it".

To get specific, the wording in PEP 20 is: "there should be one, and preferably only one, obvious way to do it". Note that the dominant idea here is that there should exist some obvious way. It's merely preferable that there be only one way. Again: this is sensible, but it's not good fodder for newcomers craving purity, or for detractors craving straw men.

PEP 20 itself is often elevated to religious levels of importance, as if it were a design document that served as a blueprint for the design of Python. It's absolutely not that; it was written by Tim Peters (not Guido!) fully eight years after Python's first release. Here's the original email that Tim sent to comp.lang.python on 4 June, 1999: https://groups.google.com/d/msg/comp.lang.python/B_VxeTBClM0.... Note how he finishes: "If the answer to any Python design issue isn't obvious after reading those -- well, I just give up <wink>." Tim is very particular about his winks, and that's not even a <0.5 wink> or a <0.9 wink>, but a full, unqualified <wink>.

To put all of those pieces together: (1) we have a short, tongue-in-cheek document written after-the-fact. (2) It's misinterpreted as a design document for an entire language and ecosystem. (3) A secondary portion of one of its points is misinterpreted to be the entirety of the point. (4) This is done by exuberant newcomers and skeptical detractors who don't accurately represent the Python culture as a whole. This is why you get the impression that the community is adamant about "one way to do it". It's a reasonable extrapolation from the visible evidence, but it's not true.

Thanks, that's a very clear and well thought out explanation. I'll make sure not to take the skeptical detracting too far in the future!
Besides, it only says that preferably there should be only one obvious way to do it.
pure speculation, because i don't know the interior history of python:

1. perl has always prided itself that "there's more than one way to do it" including repeated, prominent use of an acronym for that. see timtowtdi.

2. there is a theoretical idea kicking around out there that, if a language allowed for only one way to express any idea, then that language would be a better language (all else being equal) because if you and I always write the same code for the same task, we could easily maintain each other's work. see for example "egoless programming" or the ideas that led to Simonyi's "metaprogramming" (whether or not you agree)

3. perl is a mess

therefore, it might, given the history, make sense to say that about python as a way of trying to point out a salient difference from perl

I have always assumed that that statement was supposed to directly contrast with TIMTOWTDI.
I've never seen that sort of response from the Python community. I've seen plenty of discussion and recommendation about what is "Pythonic", but never about there being "one way to do it". If anything, python is touted as being able to do things in multiple ways, though that is very grey territory due to it being a very dynamic, patchable language.