Live data from Hacker News

Ask HN: Why Did Python Win?

news.ycombinator.com

111–120 of 162 posts

Re: Ask HN: Why Did Python Win?

#111

Ex-product manager of an IDE and language here. Languages, like just about anything, win because of what you can do with them: ie, value. Consider Ruby on Rails: it drove Ruby; the achievement was easily creating fullstack web apps, at just the right time. Consider VB: you could build UI apps. No languages win based on the language itself but what it lets you achieve. Usually, this is in the form of libraries:* ie, f…

> None of this is the language, per se. People were not 'using Python'; they were (say) using SciPy.

Sure, but the language itself has a lot to do with why library writers choose to target that language.

Re: Ask HN: Why Did Python Win?

#112

Earlier quoted context omitted.

> Python gets a lot of grief from the perspective of people who are frustrated because they didn't start off using virtual environments and now their global python package namespace is a nightmare. I never got to the "nightmare" stage before learning about venvs. But it's still nice sometimes to have an environment ready to go full of popular, non-conflicting things to play around with a REPL in.

I wonder why activating a venv ended up being implemented as a script you source (updates env vars in the current process) and deactivate (puts them back) rather than being something that puts you in a subshell (detects your current shell and re-invokes it with new vars). subshells would let you nest venvs so you could have a "sane defaults" venv, and then you could descent into madness with another "wacky experiment…

> I wonder why activating a venv ended up being implemented as a script you source (updates env vars in the current process) and deactivate (puts them back) rather than being something that puts you in a subshell (detects your current shell and re-invokes it with new vars).

The venv is just the folders and Python stubs.

The activation script concept is probably just what happened to occur to Ian Bicking first. But also maybe the subshell UX isn't so pleasant on Windows?

Certainly others have implemented subshell-based venv management.

> As it is, deactivating takes you all the way out to the system package namespace (or maybe you can nest them, not sure, but it's up to the venv implementation and not your OS to restore the intermediate env).

The effects do not nest, at least not with the *sh activate script. You'd need to implement a stack of old environment variable settings.

But I think the use case you describe just doesn't resonate with a lot of people.

Re: Ask HN: Why Did Python Win?

#113
Slightly amusing story: the year is 1990-something and I'm in grad school working a lab where we do electromagnetic simulation. That code has to run fast, obviously, but some of us in the lab were looking for some glue language to wrap around the very utilitarian C that the simulation code was written in.

One of us started playing with Perl. He ended up dropping out and going to work as a SysAdmin.

One of us started playing with Tcl/Tk. He ended up changing majors and going into UI/UX testing.

I started playing with Python, which at that point was, I think, at 0.9.2 or something. Eventually, after some twists and turns, I went on to work on ML stuff.

Is there a lesson in that? Probably not, but somehow I find it amusing all the same.

Re: Ask HN: Why Did Python Win?

#114
post #108

Earlier quoted context omitted.

I forgot two, er, three: 9. Python got lucky that its inevitable screwups (Python3) didn’t quite kill it. 10. Swift and Kotlin both define programming as serving the compiler (specifically LLVM) rather than serving the coder’s problem . (I haven’t discussed Rust so far since it isn’t attempting to compete with 98% of Python use cases, but if you squint you can see it as going one step further than Swift and Kotlin an…

Kotlin didn't target LLVM at all when it was designed, that feature came much later. The primary target for Kotlin is and always was the JVM. And Kotlin was designed with usability in mind from day one, that was the justification for it. Weird to say Kotlin define programming as serving the compiler. The compiler bends over backwards to serve the user.

Thank you for the correction

Re: Ask HN: Why Did Python Win?

#115
post #85

1. Python was designed by testing syntax with novice users to see what they could adopt easily.[1] > 90% of current Python users weren’t born when it was created. They all had to learn, and Python is the easiest language to learn because Guido and his teammates, unlike $LANGUAGE_DESIGN_GOD, approach the problem as experimental scientists rather than auteurs. 2. Python is conceptually compact, dominated by hash tables…

I feel like if #1 was done today, there is no way on god's green earth that whitespace would be used for code blocks. It is far and away the most common footgun novices run into when I'm answering questions about why their code doesn't work.

My background is philosophy of language. I studied formal/mathematical logic in grad school. I was always embarrassed that I couldn't code, but the computer sciences classes were teaching languages that were inscrutable for someone even with my background, with syntax heavily focused on jargony math and technical concepts like object orientation (likely java at the time).

Around 2010, I was talking about this with friend about this failing of mine, and he said "you should try python, I've heard it is popular with non-math folks." So I bought a book, and as soon as I opened it, I could just read it. It took me a couple days of reading to wrap my head around object orientation, but on the functional side, I could have written fizz buzz like, maybe half an hour after opening the book.

Humans have logic pre-built into our brains, it's just that we use natural language as our syntax. Python cleverly used as much of the natural language syntax as was practicable to remove the barriers to entry for non-math majors. Whitespace is perfect example of a natural language syntax feature.

Re: Ask HN: Why Did Python Win?

#116
I think part of why Python won is that it is community driven. Many high level languages that compete with Python are created by some big tech business or the other. But people are less trusting of programming languages created by a big tech business. There have been cases where such languages have had license changes or other problems.

Re: Ask HN: Why Did Python Win?

#117
post #94

> In hindsight I think Python needed to stand on its own right, not just as a better Perl, but yet here we are. It has . That just wasn't where the foothold was. Python has had several moments propelling it to its current position. "The early days" absolutely did not set an inexorable machine in motion. It took further boosts from fields like data science, machine learning etc. that would likely never have touched Pe…

All true.

But also:

> It just turns out that homoiconicity is not hugely useful the large percentage of the time that you don't need metaprogramming,

It turns out that metaprogramming, like anything else, has many possible levels, and that for the shallower levels, Python's reflection, magic methods, and metaclasses suffice without too much heartburn.

Re: Ask HN: Why Did Python Win?

#118

One contributor that I don't see mentioned elsewhere: For many many python users, their only touchpoint for the language is reading and writing it. Python gets a lot of grief from the perspective of people who are frustrated because they didn't start off using virtual environments and now their global python package namespace is a nightmare. Legit criticisms, but for many non-developer python users those problems are…

> [conflicts in virtual environments are] most likely our problems, but we aren't the users that python is made for. We're support for those users.

Maybe? I mean, if people aren't noticing these issues and you are, how are they relying on your support?

> It's winning because its audience is not code specialists, but other kinds of specialists which sometimes need to use code. Their work often has a sort of immediate importance that ours often doesn't. It's not evaluated based on whether the techies like it, it's evaluated based on whether the scientists, the analysist, the students, and the {non-computery-engineering} Engineers like it.

There is no bright line. I'm a code specialist. I use Python as a tool to help build other code. I don't have any venv problems because my git repo has everything I need in it.

Re: Ask HN: Why Did Python Win?

#119
post #117
post #94

> In hindsight I think Python needed to stand on its own right, not just as a better Perl, but yet here we are. It has . That just wasn't where the foothold was. Python has had several moments propelling it to its current position. "The early days" absolutely did not set an inexorable machine in motion. It took further boosts from fields like data science, machine learning etc. that would likely never have touched Pe…

All true. But also: > It just turns out that homoiconicity is not hugely useful the large percentage of the time that you don't need metaprogramming, It turns out that metaprogramming, like anything else, has many possible levels, and that for the shallower levels, Python's reflection, magic methods, and metaclasses suffice without too much heartburn.

Honestly I feel like even metaclasses are overused, where class decorators would often suffice.

Re: Ask HN: Why Did Python Win?

#120

You can't only look at it from the perspective of a software engineer. Ordinary people can read and write Python much more easily than a ton of other languages. It's very easy to get started, with basically no ceremony. Highly tolerant of user errors yet still allows one to grow with the language (nobody writes ABCs on their first day). Python has issues, but those issues don't matter equally to everyone and every us…

> You can't only look at it from the perspective of a software engineer.

This is absolutely true.

OTOH, the "No true Scotsman" attitude that some display, that no real programmer would deliberately use Python, always says a lot about the one displaying the attitude.

Post reply on HN