News for hackers. Stuff that matters.
Re:Ask HN: Why Did Python Win? by rout39574 on Tuesday August 29, 2023 @05:36PM (#37314468)
So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition to Perl's vigorous advocacy of More Than One Way.

Python has been really winning for some time, so it's natural that its ideological discipline has grown ragged. The crop of kids who value options above consistency don't have the scars of the Perl age to inform their prejudices.

But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures.

Re:Ask HN: Why Did Python Win? by kbenson on Tuesday August 29, 2023 @06:16PM (#37314863)
> But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures.

I would revise that to be that to be that the pythonic culture of one acceptable way to to is better matched with a lot of good development practices.

Perl was also very good at finding a Perl way to proceed. It's just that with Perl that often mean a lot of implicitness and "do what I mean", and multiple ways to do it so you could fit it within your preferred style and tailor it to the current project's needs.

That all sounds good until you are confronted with the flip side of the coin, which is that it's harder to understand when looking at something written with those perspectives for the first time or after a long hiatus from the project, which puts a lot of importance on policy and standards which saps effort from just getting something done.

I love Perl, and it's still the language I write most often for work, and it's no great mystery why Python became preferred.

Re:Ask HN: Why Did Python Win? by gabereiser on Tuesday August 29, 2023 @06:50PM (#37315182)
Not just practices, tooling. The whole typing system. Linting to check for mistakes. For the love of black.
Re:Ask HN: Why Did Python Win? by KptMarchewa on Tuesday August 29, 2023 @07:49PM (#37315736)
Python's static typing still feels very very clunky and bolted on, and tooling around it was rather bad, like mypy. In general I definitely wouldn't say python tooling was good. It's improving rapidly with ruff tho, just as JavaScript when esbuild appeared.
Re:Ask HN: Why Did Python Win? by mardifoufs on Tuesday August 29, 2023 @08:50PM (#37316225)
Dumb question: I know the built-in typing (import typing) is limited in some ways, but it works pretty fine to cover most basic needs. So what does mypy add? I'm super interested in adding typing to some code we have but I'm just a bit confused by the choices available.

Would mypy with pydantic be a good combination or do they overlap?

Re:Ask HN: Why Did Python Win? by woodruffw on Tuesday August 29, 2023 @08:54PM (#37316263)
The two are complementary: the built-in `typing` module only provides type annotations, not type checking. Mypy provides the latter, via the type annotations that you (and others) add to Python codebases.

Pydantic overlaps with mypy in the sense that it provides a mypy plugin, but otherwise it's just like any other Python library.

Re:Ask HN: Why Did Python Win? by mardifoufs on Tuesday August 29, 2023 @09:10PM (#37316388)
So mypy runs "at run time"? I guess that makes sense, I thought the annotations provided some form of checking too, but now I realize that I should really spend some time to inform myself better :').
Re:Ask HN: Why Did Python Win? by woodruffw on Tuesday August 29, 2023 @09:23PM (#37316496)
Sort of -- mypy is its own standalone program, and you run it to typecheck your program's type annotations. It does some evaluation of the Python program (specifically imports and some very basic conditional evaluation, among other things), but it never really executes the codebase itself.
Re:Ask HN: Why Did Python Win? by stableviper on Tuesday August 29, 2023 @09:22PM (#37316477)
No, it's more that pydantic runs "at run time" while mypy not.
Re:Ask HN: Why Did Python Win? by gabereiser on Wednesday August 30, 2023 @12:48AM (#37317799)
Mypy runs as a type linter/checker. See https://mypy-lang.org/
Re:Ask HN: Why Did Python Win? by bmitc on Wednesday August 30, 2023 @03:11AM (#37318642)
Isn't Python's tooling usually considered some of the worst?
Re:Ask HN: Why Did Python Win? by gabereiser on Wednesday August 30, 2023 @08:53AM (#37321290)
By what standard? Yours? Java developers? Rust developers? The fact that Python has typing now, tools to check those, and has plenty of tooling around “make it faster”, I think your world view might be stuck in 2010. Python has gone from a slow obscure scripting language to a powerhouse. Conda, NumPy, Scikit, PyTorch, GPU programming, Games, Analytics, web apps, API’s, I think it’s safe to say this ain’t your grandpa’s Python anymore.
Re:Ask HN: Why Did Python Win? by bmitc on Wednesday August 30, 2023 @09:28AM (#37321844)
I have seen Python in action since 2010 plenty of times, including the present. It's been a mess every time. My worldview is driven by F# and Elixir, namely the `dotnet` and `mix` tooling, respectively. So no, Python's tooling does not impress me in the slightest. The first thing you need to do is get agreement on all the different checkers, linters, formatters. For Elixir, there's one tool for each task. My worldview feels quite current.

Those other things you mentioned aren't relevant to tooling. They're distributions, libraries, and applications. But note that Conda's existence was basically due to the fact of Python's tooling being poor.

Re:Ask HN: Why Did Python Win? by gabereiser on Wednesday August 30, 2023 @10:36AM (#37322775)
You see tooling in a different view than typical Python users. Python users see things like iPython, notebooks, the ability to quickly do statistics and plot results, as tooling - to do their jobs. Data Science. Machine learning. Things that perplex and confound static-typing OOP purists. So yes, by your world view - Python is a mess. There's no one way to do things, there's no one tool, no one linter, no one formatter. I praise the fact that there isn't. What a boring world. What choice would you have if that tool didn't satisfy your needs? Find another language?

I began in that world view. The C/C++/Java/DotNet everything must have a standard, a fixation on a singular consensus. That's not how things work in the open source world of Python, javascript, rust, etc. Will there be gravitation towards a paradigm? sure, until such time that a new one emerges.

If you looked at Python in the 2.5 days and looked at Python today - You cannot argue the tooling has gotten better.

Re:Ask HN: Why Did Python Win? by bmitc on Wednesday August 30, 2023 @10:59AM (#37323184)
> You see tooling in a different view than typical Python users.

That doesn't surprise me.

I do what you mentioned with F# in Polyglot Notebooks (which support several languages in the same notebook) and Elixir in Livebook all the time, both of which are superior notebook implementations to the outdated Python Jupyter notebooks.

My worldview is not driven by comparing Python to C#, Java, C++, and other such ilk.

Re:Ask HN: Why Did Python Win? by 2colours on Monday September 04, 2023 @01:41PM (#37382910)
So following your logic, "some of the worst" includes the vast majority of actually used languages and tools. Must be cool to be on the special side. :)
Re:Ask HN: Why Did Python Win? by v3gajerusalem on Monday September 04, 2023 @02:31PM (#37383407)
They want to be lisp SOOO BAD! =)
Re:Ask HN: Why Did Python Win? by cutler on Tuesday August 29, 2023 @06:52PM (#37315215)
But Ruby took all the best bits of Perl so I'm still perplexed as to why Python "won".
Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @07:32PM (#37315582)
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.

So new programmers tended to lean towards python, because the resources to lean on others were there. And people like Raymond Hettinger, Naomi Ceder, Ned Batchelder, and Yarko Tymurciak were approachable even if the BDFL wasn't.

Re:Ask HN: Why Did Python Win? by selestify on Wednesday August 30, 2023 @06:50AM (#37320069)
What did the PSF do to make people feel accepted?
Re:Ask HN: Why Did Python Win? by cdchn on Tuesday August 29, 2023 @08:38PM (#37316133)
Because the best bits of Perl were kinda trash that Python was smart to avoid.
Re:Ask HN: Why Did Python Win? by danmur on Tuesday August 29, 2023 @11:30PM (#37317337)
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.
Re:Ask HN: Why Did Python Win? by cdchn on Wednesday August 30, 2023 @12:34AM (#37317707)
Python's clean, obvious syntax is what drew me to it. They actively decide to not do things because it detracts from the cleanliness of the syntax. Very often, less is more. My biggest fear is Python might be forgetting this, which I see with the sort of things like := operator, etc.
Re:Ask HN: Why Did Python Win? by cutler on Wednesday August 30, 2023 @08:00AM (#37320720)
God forbid we should have to familiarise ourselves with a language before using it.
Re:Ask HN: Why Did Python Win? by cdchn on Wednesday August 30, 2023 @10:05AM (#37322362)
God forbid things be intuitive.
Re:Ask HN: Why Did Python Win? by KingMob on Thursday August 31, 2023 @02:00AM (#37333011)
Funny, because 99% of current regex libraries use Perl's regex extensions.
Re:Ask HN: Why Did Python Win? by 2colours on Monday September 04, 2023 @01:38PM (#37382864)
Taking a look at the bigger picture, it does indeed seem like the Perl philosophy lost to the Python philosophy overall.

Looking at the hip n cool languages, not just Python for scripting but surely Go and to some extent Rust as well for native stuff (Dart for scripting also but it didn't outright "win"), these are mostly languages that deliberately simplified things. Yes, even Rust - it needs to be compared to C++ and its biggest feature is basically that it doesn't let you do all the things C++ does, within a very similar model.

The only language that I heard is going against these trends (but I'm largely clueless what it's actually like) is Julia which sort of has its own "lay" niche like Perl did back in the day, and is mostly winning based on the premise that it's a performant scientific language.

The industry obsesses over costs of adoption, stability, maintenance; in short: how to get the most out of the least actual new development. It does make quite a lot of sense, to be honest, although sometimes it's really demotivating at an individual level.

And frankly, "learn the language, duh" usually comes up when the language is complex or unintuitive for no practical purpose. Of course there will be people who always complain if they have to learn anything but I don't think they make the majority, or even a significant minority, in the software engineering world. "Learning the language" is only as much of a virtue as the language itself serves its purpose, which includes easy of use and the readability of someone else's code.

Re:Ask HN: Why Did Python Win? by vonwoodson on Tuesday August 29, 2023 @07:14PM (#37315448)
+1 for mentioning that python's original competitor was Perl. This point is forgotten some 20-30 years latter
Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @07:49PM (#37315738)
Not just perl, but C/C++/Java as well. Ruby was a competitor to Java JSP development back in the day. And I remember when a lot of Java people jumped ship to Ruby. I moved from C++ to python over a decade ago and never looked back.

Back then, the python jobs were scarce -- but based upon how I picked up the language, many of the typical C++ issues just disappeared -- and I knew it was going to become popular.

One comp sci professor talking at a PyCon years ago made a point that maybe the best college level introductory course probably should not have been SICP based but Python. His example was that for the first time in 5 years of teaching intro courses he had people coming up to him looking to change majors.

Re:Ask HN: Why Did Python Win? by cutler on Tuesday August 29, 2023 @08:11PM (#37315939)
MIT dropping SICP/Scheme for Python conicided with the general decline of education as an end in itself. Python is the VHS of computer languages. I couldn't believe it when I heard MIT dropped a language renowned for its elegant lambda implemenation in favour of a language in which lambdas were not only frowned upon but literally throttled. I think it says everything that MIT ditched Scheme and SICP at the same time as it would be near impossible to teach SICP with Python.
Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @10:22PM (#37316903)
I would argue that Python is the Betamax of computer languages, and C++ is the true VHS.

Fight me.

Re:Ask HN: Why Did Python Win? by GeorgeTirebiter on Tuesday September 05, 2023 @05:57PM (#37398323)
Re:Ask HN: Why Did Python Win? by bluGill on Tuesday August 29, 2023 @08:48PM (#37316216)
C++ and Python are not competitors. Sure both are Turing complete so you can implement anything in either. However if you should is a different question. Python is very difficult to maintain when you program goes over 100k lines of code, while the static type system of c++ is good for millions. C++ compiles to fast binary code, while Python is typically 60x slower for logic (though often Python calls a fast algorithm implemented in a compiled language for anything significant so this is hard to measure in typical programs). However if your programs are not very large and you don't need every last bit of speed Python is going to be easier to work with. (And frankly if not working with a legacy c++ codebase you should look at rust, ada, go, or something else i'm not aware of, c++ has many ugly warts that you shouldn't need to worry about)
Re:Ask HN: Why Did Python Win? by germandiago on Tuesday August 29, 2023 @09:34PM (#37316575)
As a person who uses C++, I must say something that also applies, somewhat, for Java.

We have all the cool kids like Kotlin, Rust, etc.

However, when it is about finishing a project, beating C++ or Java ecosystems is almost impossible.

Besides that, C++ has improved a lot over time. It still has its warts and knives but you can code very reasonable C++ with a few guidelines and there are also linters, and -Wall -Wextra -Weverything -Werror. That takes you quite far in real life provided you have a reasonable amount of training.

I would choose C++ over Rust any day. The only hope I have for C++ successors are Cppfront and Carbon and they are highly experimental. As successors those two fit the bill.

There is a third one, my favorite. It is this one: https://www.hylo-lang.org/ but I am not sure how compatible it will/would be.

Re:Ask HN: Why Did Python Win? by no_wizard on Tuesday August 29, 2023 @10:02PM (#37316761)
The one thing Rust is getting right that I hope Carbon et. al take from it is using the type system to manage memory.

not having to explicitly remember `free` in safe Rust code is amazing. Knowing that if my types are sound that memory will be managed reasonably is great.

I also think that immutable by default, mutable by explicit declaration is pretty great.

I do think there is a lot of room to add better ergonomics on these ideas however

Re:Ask HN: Why Did Python Win? by germandiago on Tuesday August 29, 2023 @10:19PM (#37316874)
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.

Besides that, in real life you end up having C in most of your software, so I am not sure how Rust behaves compared to well-written C++ with all warnings and linters on and using smart pointers. But my hypothesis is that they do not stay very far apart in safety.

There are many ways to achieve safety, and the most promising, IMHO, is the path that Hylo programming language is taking. It sticks to Generic programming and mutable value semantics.

The language base draws from Swift and it has very strong people behind that know what they are doing. For example David Abrahams and Sean Parent. This is an implementation in a language of many of the ideas from "Better Code" from Sean Parent. It has a very solid foundation.

Besides being a solid foundation for generic programming, value semantics, and concurrency, what I like the most is how much it simplifies the model by not escaping references all around and preventing unnecessary copies. This removes the (IMHO) mess that is to have to manage reference escaping constantly in Rust, reason why many patterns such as Linked lists are not even possible.

And Lists are not just an academic exercise, as I was told sometimes by Rust proponents. Linked structures (Inmutable linked structures actually) are important in scenarios such as TelCo backend where you need replication, fast moving of data and history versioning, rollbacks and so on.

Re:Ask HN: Why Did Python Win? by no_wizard on Tuesday August 29, 2023 @10:28PM (#37316944)
All this may be true (I'm not the strongest C++ developer in the world, relatively limited exposure), however the Rust memory management via the type system feels natural once you wrap your head around it. That idea is really good. I always hated dealing with `delete`, `free` and `malloc`.

Being able to offload all that busy work to the type system is just nice. There are definitely ergonomic improvements that could be made around this.

All the rest? I'll leave that to someone else to talk through, as I'm no expert here.

Re:Ask HN: Why Did Python Win? by germandiago on Tuesday August 29, 2023 @10:34PM (#37316981)
> however the Rust memory management via the type system feels natural once you wrap your head around it

It disallows many valid patterns. That is why I recommend to take a look at Hylo programming language (before called Val lang) to see what I think it is a very good example of how to make a language safe without making the learning curve so steep and without a need for a GC.

Re:Ask HN: Why Did Python Win? by no_wizard on Wednesday August 30, 2023 @10:19AM (#37322530)
The way Rust does it may disallow valid patterns, but it is not inherent to the idea
Re:Ask HN: Why Did Python Win? by bluGill on Tuesday August 29, 2023 @11:02PM (#37317152)
I.write c++ all the time, and I go months between needing new or delete. Unique_ptr is a wonderful thing. Not quite as powerful as rust's borrow checker, but it saves me a lot of thinking.
Re:Ask HN: Why Did Python Win? by lelanthran on Wednesday August 30, 2023 @01:41AM (#37318108)
> 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 deep Rust expertise.[1]

The argument of "just get gud" whenever you point out the deep learning curve of Rust is pointless; I have noticed that Rust experts only come when your employer is rich enough to pay the team to not deliver while they learn it: Basically only FAANGs and startups flush with VC money.

[1] When I have a small project I reach for C. When I need something bigger for which C is not suitable, I don't reach for C++, or Rust, I rather take the tiny performance hit and move to Go. On extremely large projects, where I work with others, C# and Java seem to hit the sweet spot.[2]

[2] Although, C# and Java are also getting a bit too complicated for my tastes too. Seems to me that every language follows C++ evolution towards complexity, because the people stewarding the language are experts in that language and/or in programming language theory.[3] They are comfortable with the changes they propose because they have no need to upskill (they are already at that skill level).

[3] I propose that a language designed by your average corporate developer who has 15 years of experience but not CS degree will have much higher adoption than languages designed by PL purists.

Re:Ask HN: Why Did Python Win? by mighmi on Wednesday August 30, 2023 @03:50PM (#37327984)
What makes you choose Go over C#/Java for medium projects? And why not go for the large projects?
Re:Ask HN: Why Did Python Win? by lelanthran on Thursday August 31, 2023 @03:44PM (#37342711)
> 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? by germandiago on Monday September 04, 2023 @03:32AM (#37378055)
> How about simply saying "calling async functions only schedules the function for later execution, it doesn't execute it".

This is not always true.

Re:Ask HN: Why Did Python Win? by sacado2 on Thursday August 31, 2023 @08:06AM (#37335883)
> well-written C++ with all warnings and linters on and using smart pointers. But my hypothesis is that they do not stay very far apart in safety.

Can C++ compilers + linters reliably detect all misuses of unique_ptr? Because that sounds like a halting-problem kind of problem, and as soon as you can't guarantee memory-safety, you're definitely not in the same ballpark in terms of safety. I mean, memory-unsafety is the number one vulnerability cause in software. C++ has many qualities, but safety certainly isn't one of them.

Re:Ask HN: Why Did Python Win? by germandiago on Monday September 04, 2023 @03:40AM (#37378111)
> Can C++ compilers + linters reliably detect all misuses of unique_ptr? Because that sounds like a halting-problem kind of problem, and as soon as you can't guarantee memory-safety, you're definitely not in the same ballpark in terms of safety.

Is C and assembly the same level of memroy safety? Probably yes... but no, it is not in practice.

And C and C++? Yes, in theory, in practice... C++ is safer.

How about Rust? In theory Rust is safer. In practice, you are going to use C libraries here and there, so... in practice not as safe as advertised.

Well-written C++ with -Wall -Werror, -Weverything, -Wextra... that is very safe, including detecting even dangling stuff. If you stick to `shared_ptr` and `unique_ptr` no matter how much you complain about it: Rust with its C shims and C++ with all linters and a good environment are practically at similar levels of safety.

This is the practical, real thing that happens. I do use C++ for every day use for around 14 years professionally and 20 years in total.

You are all in the terrain of theory, but how much Rust and C++ have you really written?

Of course, the CVEs data about memory safety, well, those are true. And they are a real problem. But with a reasonably good use of C++ those would be much, much, much lower than they have been so far.

Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @10:28PM (#37316945)
> However, when it is about finishing a project, beating C++ or Java ecosystems is almost impossible.

Yet, somehow people do this with python, perl, and ruby. Google hires professional python people too.

Re:Ask HN: Why Did Python Win? by hbrn on Wednesday August 30, 2023 @02:06AM (#37318268)
Not only do this, but do it way more successfully. I'll never get tired of repeating that among top YC startups, Java as a primary language contributes to roughly 1% of value, while Python + Ruby are almost at 70%.

https://charliereese.ca/y-combinator-top-50-software-startup...

Re:Ask HN: Why Did Python Win? by germandiago on Wednesday August 30, 2023 @04:16PM (#37328358)
If by successfully you mean time to market, for sure you are right.

C++ gives more return when you start to save in infra because you have a more efficient language, if coded properly. Same goes for Go vs Python.

The right tool for the right job. I would use (and will, I am on it) Django for a SaaS that I have for the backend. If things start to work relatively well, then, I will keep identifying, if there are, bottlenecks and migrate with a hybrid architecture parts of the workload to C++.

This allows me to save in infrastructure bills.

Re:Ask HN: Why Did Python Win? by fuzztester on Tuesday August 29, 2023 @11:57PM (#37317493)
Hylo page says it was formerly Val.

IIRC, Val has been mentioned on HN sometimes earlier.

Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @10:26PM (#37316937)
As painful as the Python package system is, C/C++ is so much worse.

I remember trying to compile GTK+ on a solaris system a decade ago, and remembering how terrible it was to even to get it to compile.

You're really deluding yourself if spending your time in compiler dependency hell is so much better than python.

Re:Ask HN: Why Did Python Win? by intalentive on Wednesday August 30, 2023 @08:54AM (#37321298)
The new CMake package manager may make things easier.
Re:Ask HN: Why Did Python Win? by hbrn on Wednesday August 30, 2023 @01:58AM (#37318213)
> Python is very difficult to maintain when you program goes over 100k lines of code, while the static type system of c++ is good for millions

I see this argument a lot, but people often forget that Python is very concise (yet readable) compared to other languages.

100k LOC in Python typically contains way more business logic than C++, so it is only natural to be harder to maintain.

Re:Ask HN: Why Did Python Win? by bluGill on Wednesday August 30, 2023 @06:24AM (#37319813)
Python ismuch less concise at this size. Sure your algorithms are more concise, but you lose all of that and more because it you don't have 100% test coverage you never know when a stupid typo will make your program crash, while with c++ you typically can be fine with more reasonable coverage, say 80% where the last 20% is things hard to test that are unlikely to fail anyway. At that scale Python is slower to build as well because c++ lets your tests depend only one the files that changed and this your code-build-test cycle is faster despite c++ being famously slow to compile.
Re:Ask HN: Why Did Python Win? by nyolfen on Tuesday August 29, 2023 @09:28PM (#37316535)
> the best college level introductory course probably should not have been SICP based but Python

i saw this linked on here recently: https://wizardforcel.gitbooks.io/sicp-in-python/content/

Re:Ask HN: Why Did Python Win? by Stranger43 on Tuesday August 29, 2023 @08:44PM (#37316186)
And were of cause forgetting VisualBasic because who cares about microsoftland those days but back when python/ruby emerged even windows server and IIS was relevant as this was kind of the peak of microsoft's dominance.
Re:Ask HN: Why Did Python Win? by Illotus on Wednesday August 30, 2023 @12:01AM (#37317514)
Yes, it is pretty weird to think that VB.Net flavor was fairly used in web dev even as late as 2006.
Re:Ask HN: Why Did Python Win? by mdbauman on Tuesday August 29, 2023 @07:34PM (#37315605)
Back when I decided it was time to add a scripting language, Perl and Python seemed like the obvious choices, and in my mind were equally good options. I asked my best friend which I should choose, and he more or less said, "You can't go wrong with either one, but when you ask for help Perl people are assholes and Python people are nice."

I can't confirm his thoughts on Perl and I haven't interacted much with Ruby, but the Python community is definitely welcoming and patient in my experience. I wouldn't be surprised if this was a significant factor in Python's prevalence over Perl, Ruby, or anything else.

Re:Ask HN: Why Did Python Win? by stevage on Tuesday August 29, 2023 @07:56PM (#37315806)
Oh I have met Ruby people and it's a big factor in why I never learnt the language.
Re:Ask HN: Why Did Python Win? by cutler on Tuesday August 29, 2023 @08:03PM (#37315869)
I can't imagine Python's welcoming community has anything to do with it. If anything it was Ruby that had a reputation for being the most welcoming community with its MINASWAN (cringe) philosophy.
Re:Ask HN: Why Did Python Win? by woodruffw on Tuesday August 29, 2023 @08:40PM (#37316156)
I'm genuinely curious: what's "cringe" about MINASWAN?

(I write mostly Python these days, but have been involved in both communities for a long time, and MINASWAN never particularly stood out to me other than as a cute reminder to be nice.)

Re:Ask HN: Why Did Python Win? by cutler on Tuesday August 29, 2023 @09:47PM (#37316660)
It was meant tongue in cheek as I was defending Ruby being the most welcoming community. It's just a bit twee like the voice-over on London Underground - "See it, say it, sorted".
Re:Ask HN: Why Did Python Win? by kaycey2022 on Wednesday August 30, 2023 @03:35PM (#37327753)
There is no problem with someone being nice. It's only a problem when they want you to be nice exactly like them.
Re:Ask HN: Why Did Python Win? by twobitshifter on Tuesday August 29, 2023 @09:26PM (#37316512)
Maz (ruby author) is nice and so we are nice, isn’t so bad. It’s twee sounding but saying you are going to follow the example set by the founder is absolutely fine. Is it any worse than the Python ‘benevolent dictator for life’ example?
Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @11:08PM (#37317183)
I'm going to answer your question directly: No, it's not worse.

My interactions with Guido haven't been awesome. But the people put up with him regardless. The other people in python have been awesome.

Re:Ask HN: Why Did Python Win? by lelanthran on Wednesday August 30, 2023 @02:04AM (#37318255)
> I can't imagine Python's welcoming community has anything to do with it. If anything it was Ruby that had a reputation for being the most welcoming community with its MINASWAN (cringe) philosophy.

TBH, community had nothing to do with Python's enormous success over its competitors (Perl, and Ruby. Possibly Tcl too.).

Nor did any technical merit, nor ergonomics.

There's one, and only one, reason why Python exploded at the expense of the other competitors: The ease and acceptance of using the language as glue for C functions.

Python's popularity is built on a solid foundation compatibility with C.

If, in the 90s, C++ had taken off enough to displace C, I doubt Python would be as popular as it is. Python owes its ubiquity to C, because if C was not ubiquitous, Python wouldn't be either.

(It's only recently, like the last 10 year or so, that I started seeing popular Python programs which didn't have a dependency on C libraries. And even now, it's still rare to see).

Re:Ask HN: Why Did Python Win? by GeorgeTirebiter on Tuesday September 05, 2023 @05:44PM (#37398185)
I don't think your analysis is accurate.

My experience of trying to get my own C functions to use in Python to have been nightmarish. Yes, you can do it... if you have exactly the same compiler & version used to produce the python interpreter itself.

C's only usefulness to Python is: it allows optimization of the 80/20 or 90/10 rule, so performance doesn't have to totally suck with Python.

Python 'won' IMHO because it hit a sweet spot -- simple enough for beginners, in fact, beginner-friendly, but due to having a good basic set of datatypes (lists, tuples, sets, plus the usual ints, floats, and complex) -- this allowed complex ideas to be compactly expressed. The ability to switch between functional and imperative styles also helped.

Python is a 'good enough' lisp. MIT switched, and Norvig has said as much.

No, the astonishing thing is that Python survived the 2->3 transition, and came out stronger on the other end. Language cleanups, new 'syntactic sugar' (e.g. @ as the decorator syntax), and what you see is Python is trying to actively steal all the successful programming paradigms under one unified syntax.

Is python perfect? Hardly. But it's beginner-friendly and expert-optimized. AND, unlike C++ (at least for me), you can get ALL of Python into your head at the same time. (Libraries, ok, but true in any language). In this specific sense, it is exactly like C (you can keep it all in your head, even the edge cases).

There are newer languages gunning for a piece of Python's mindshare (Zig, Nim). But because Python is a moving target: getting better and better, the others will need to provide a spectacular use-case advantage --- and I just don't see that happening.

Re:Ask HN: Why Did Python Win? by Stranger43 on Tuesday August 29, 2023 @08:39PM (#37316142)
yep the Perl community kind of had issues around the turn of the millennium and the perl6 debacle did a lot to convince people that Perl was kind of a dead end.

I don't think there was any toxicity in the Ruby community but it was made up of working programmers where as the big leading voices in the python community was teaching assistants and students so it might have been more tailored to newbies.

I don't recall there being much real industrial use of python prior to Ruby emerging even if python is technically older so i think the real answer lies in why the educational sector decided that teaching python was easier and significant whitespace plays a huge part here.

Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @10:54PM (#37317100)
> I don't recall there being much real industrial use of python prior to Ruby emerging even if python is technically older

Yeah that's my recollection too. About 2011ish there weren't a lot of jobs in python yet. Perhaps in SV, but not out in the real world. Several startups were doing it, including Youtube and google at the time.

But in the F500 world, python wasn't used at all. I started using it in 2008/9-ish.

Re:Ask HN: Why Did Python Win? by rolandog on Tuesday August 29, 2023 @11:45PM (#37317427)
> [...] the perl6 debacle did a lot to convince people that Perl was kind of a dead end.

Not GP, but the Python 2 vs 3 holy wars were also something that kept me from adopting Python as a scripting language a couple of years.

Re:Ask HN: Why Did Python Win? by bb88 on Wednesday August 30, 2023 @12:09AM (#37317555)
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 anyway now. Many things introduced in the 3.x series before 3.6 just don't work anymore (asyncio syntax being the notable one).

Re:Ask HN: Why Did Python Win? by masklinn on Wednesday August 30, 2023 @12:55AM (#37317837)
> 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 they did not get it in the end.

> In fact they pretty much just threw away anything before python 3.6 anyway now. Many things introduced in the 3.x series before 3.6 just don't work anymore (asyncio syntax being the notable one).

What?

Re:Ask HN: Why Did Python Win? by selestify on Wednesday August 30, 2023 @06:49AM (#37320054)
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? by masklinn on Wednesday August 30, 2023 @07:34AM (#37320465)
> 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? by bluGill on Tuesday August 29, 2023 @08:41PM (#37316162)
The only ruby person i've met was insistent that ruby was the one true way and he trued to force it into everything. That attitude turned me off.

Of course I already knew Python, and so did the rest of my team so we had been doing tools in Python (the guy wasn't on my team), but until he pushed ruby into places where python would have been better (import a Python library rather than shell to out to a program) I was willing to accept it was probably fine '

Re:Ask HN: Why Did Python Win? by sodapopcan on Tuesday August 29, 2023 @09:25PM (#37316502)
> The only ruby person I've met was insistent that ruby was the one true way and he trued to force it into everything. That attitude turned me off.

I mean, if you read almost any Elixir article that has hit the front page of HN, there are always comments from Pythonistas saying, "Why bother when there's Python?" Similar attitude. Obviously it's not everyone, but it's not everyone in the Ruby community either.

Re:Ask HN: Why Did Python Win? by nindalf on Wednesday August 30, 2023 @03:16AM (#37318675)
It’s such a bizarre reason. “One person using something rubbed me the wrong way so I decided not to use it”. Did the person extrapolate to an entire community from a sample size of 1?
Re:Ask HN: Why Did Python Win? by hosh on Tuesday August 29, 2023 @09:51PM (#37316687)
Python and Ruby have some things where the intuitions are exactly inverted from one another. It took me a long time to figure out why Python rubbed me the wrong, and that if I dig up how I used to structure code in Pascal, it’s fine.

Not that I care much these days since I prefer writing in Elixir.

Re:Ask HN: Why Did Python Win? by JohnBooty on Tuesday August 29, 2023 @09:57PM (#37316731)

    The only ruby person i've met was insistent that ruby was the one true way
That sucks. I've been doing Ruby full-time since 2014 at 4 companies and I've never seen that sentiment. My experiences have been really positive.
Re:Ask HN: Why Did Python Win? by bb88 on Tuesday August 29, 2023 @11:06PM (#37317169)
My experience with python was simply, people wanting to get shit done. This was circa 2008. They weren't really engaging in language wars, but doing innovative things like extending Java, with Jython.

I was arguing for the F500 company I was working on to explore using Jython to write unit tests for Java code.

Why not have a scripting language to write unit tests for Java code?

I see this with Rust trying to extend python in interesting ways. I don't see this with Java trying to extend C/C++ or Python.

Re:Ask HN: Why Did Python Win? by zerbinxx on Tuesday August 29, 2023 @11:09PM (#37317201)
I agree. I’ve found ruby and its developers to be pretty friendly and open to other languages and styles.
Re:Ask HN: Why Did Python Win? by truculent on Tuesday August 29, 2023 @11:47PM (#37317438)
That’s funny because that’s one of the reasons I tend to point beginners to R instead of Python for data work.
Re:Ask HN: Why Did Python Win? by Lammy on Wednesday August 30, 2023 @12:22AM (#37317620)
> I haven't interacted much with Ruby

“Matz is nice and so we are nice” https://en.wiktionary.org/wiki/MINASWAN :)

The Rails community is another story, unfortunately.

Re:Ask HN: Why Did Python Win? by abareplace on Wednesday August 30, 2023 @04:17AM (#37319069)
In my experience, Python programmers are closed-minded novices who cannot understand anything else than Python. I published a blog post about Python problems [1] many years ago and angry Pythonistas attacked me in the comments. So I don't agree with your description of the community as "welcoming".

[1] https://www.strchr.com/python_critique

Re:Ask HN: Why Did Python Win? by saikia81 on Wednesday August 30, 2023 @04:46AM (#37319232)
You are not asking for help. The comments on your critique are patient, and explain how to look at things different. Just because people disagree, does not mean they 'attack's you.

Honestly, your critiques seem more like opinions. The comments are pretty spot on that these are not issues. Your perspective on the default data types is off though. This is not an attack. I simply disagree with you descriptions and opinions.

Re:Ask HN: Why Did Python Win? by abareplace on Wednesday August 30, 2023 @06:27AM (#37319830)
And now I have 2 minuses on this Hacker News comment from the angry Pythonistas :D That's how they attack you.

These people learned only Python, don't know any other programming language, and now evangelize it to everyone, making excuses for its obvious faults and problems. That's the essence of this community.

Re:Ask HN: Why Did Python Win? by allarm on Wednesday August 30, 2023 @05:08AM (#37319344)
I've checked the article and the comments are awesome, not sure what you're talking about. People disagree with you, respectfully, explaining why they think you're wrong. What did you expect from the "welcoming" community, ignoring the critique?
Re:Ask HN: Why Did Python Win? by abareplace on Wednesday August 30, 2023 @06:21AM (#37319775)
Not ignoring, but taking it seriously without demagogy and trying to prove that 2+2 equals to five.
Re:Ask HN: Why Did Python Win? by allarm on Wednesday August 30, 2023 @05:48PM (#37329614)
I’m not an expert in Python by all means and not going to take any side. I’m just saying that the comments look meaningful and the commenters seem to be open for discussion. It’s definitely not a norm in modern Internet, which is already great.
Re:Ask HN: Why Did Python Win? by dang on Wednesday August 30, 2023 @03:51PM (#37327999)
Please don't start flamewars on HN. Programming language flamewars are particularly easy to avoid, and avoiding them has always been a priority here because we're aware of what happened to certain other forums, which burned themselves to a crisp and never recovered.

We detached this subthread from https://news.ycombinator.com/item?id=37315605.

Re:Ask HN: Why Did Python Win? by endgame on Tuesday August 29, 2023 @11:08PM (#37317188)
I disagree: Python seems to have a zillion build tools and multiple competing type-checkers.
Re:Ask HN: Why Did Python Win? by sharts on Wednesday August 30, 2023 @04:18AM (#37319074)
I think Python has some of the worst API documentation I’ve ever read.

Even Java puts it to shame and that is sad

Re:Ask HN: Why Did Python Win? by kiwijamo on Wednesday August 30, 2023 @04:47AM (#37319241)
Coming to Python from PHP it was interesting to see that in the PHP world I'd get 80% of my knowledge from the PHP documentation and 20% elsewhere. In the Python world it's easily the other way around. It also doesn't help that the PHP documentation is more up to date so I am using the most current info, while for Python their own docs are so bad I rely on other docs but they all vary on what version of Python it depends on and whether it follows current best practice. The difference is night and day and one of the reason I ended up going back to PHP.
Re:Ask HN: Why Did Python Win? by g8oz on Wednesday August 30, 2023 @08:20AM (#37320921)
Yeah the PHP documentation is extremely pragmatic and seems designed to get you going quickly with useful examples.

The Python documentation seems to be suffering from some sort of weird snobbery. Very wordy as another comment mentioned. Examples are frequently lacking or inadequate. They seem like they're trying to compete with MSDN in "professionalism" although these days even the MSDN examples are better. There is an entire ecosystem of python tutorial websites around the web that would not exist if the documentation was as helpful as that of PHP.

Re:Ask HN: Why Did Python Win? by frou_dh on Wednesday August 30, 2023 @06:08AM (#37319690)
The stdlib documentation definitely has a unique flavour. I would characterise it as "wordy".
Re:Ask HN: Why Did Python Win? by lukeck on Wednesday August 30, 2023 @05:10AM (#37319360)
> There should be one-- and preferably only one --obvious way to do it.

I just wish Python applied this approach to package management. It is needlessly complicated.

Re:Ask HN: Why Did Python Win? by Doxin on Thursday August 31, 2023 @04:26AM (#37334092)
The obvious part is definitely lacking, but the long and short of it is basically to ignore all the newfangled solutions. They are much more trouble than they are worth. Just use pip with a venv and a requirements.txt (easier) or a pyproject.toml (cleaner).

I really fail to see what the newer tools actually bring to the table. From my experience they solve no actual problems and just introduce more bugs and weird behavior.