6 ms·
Python popularity is self re enforcing. It's popular because it's popular. Not because it is fast or particularly good at anything it does. It arguably isn't th
by jillesvangurp 2y ago
Python popularity is self re enforcing. It's popular because it's popular. Not because it is fast or particularly good at anything it does. It arguably isn't that great for a lot of things people use it for. A lot of that popularity just stems from people already knowing it and the existence of lots of libraries and tools. It's a bit the Visual Basic (if you are old enough to remember that being popular) of the data science world. Lots of people use it that aren't necessarily very good software engineers or even focused on that.
It's not my first choice for a lot of things but I can work with it when needed and it gets the job done. I'm currently doing a project on the side in python for one of my clients and I'm getting familiar with some new things like async and a few other things. It's fine.
Nim, Mojo, and a few other python dialects kind of point to the future for python itself as well. The recent decision to get rid of the GIL is a step in the right direction and there has been incremental progress on interpreter and jit internals as well in recent releases. It might never get quite as fast but it can get a lot closer to those.
And having some new options to implement stuff in that needs to be fast other than C is probably a good thing. A lot of popular python libraries don't necessarily contain a lot of python code. You see the same in the javascript world where there's a lot of WASM creeping into the space lately.
- wraptile 2y ago> Python popularity is self re enforcing. It's popular because it's popular I'm sorry but that's just an incredibly ignorant take. Python revolutionized programming. I was in Euro Python 2016 (or something) and Guido van Rossum (founder of the language) did a surprise visit and a line of people would form around him every now and then of people thanking him for making programming and development so thoughtful and accessible which changed people's lives. I was in the line too. Python's approach to programming and the whole language design, community, enhancement proposals like PEP-8 and Python Foundation to this day is mostly unmatched. Python is absolutely brilliant!
- deleted 2y ago[deleted]
- moi2388 2y agoIt did, just imo not in a positive way. Not typesafe, everything is global, terrible syntax with significant white space, virtual environments hassle, very slow.. All it did was make people not have to think whilst programming leading to a whole bunch of terribly optimised one-shot scripts that have no business being in production
- otabdeveloper4 2y agoPython was originally a teaching programming language. You know, for kids and first-year students, as a replacement for BASIC. Now that we use it for building enterprise crap it has turned into some sort of lovecraftian rube goldberg machine, but around the Python 1.5 days it was, indeed, a nice and simple no-nonsense language.
- moi2388 2y agoIf it was used only as that, for perhaps the first introductory course, I think it’d be great. That’s exactly the scope it should be used in, and no further
- icedchai 2y agoHow do you feel about other scripting languages? Ruby? PHP? Perl?
- pjmlp 2y agoThey should be mostly used for scripting exactly, not full blow applications, unless a JIT is part of the story. Which incidentally, Facebook had to spend millions of dollars adding one into PHP, across multiple attempts. And Shoppify is doing the same to Ruby. Because as Facebook pointed out during their efforts, every single 1% performance improvement, represents millions of saved dollars in infrastructure costs.
- edanm 2y ago> Python was originally a teaching programming language. You know, for kids and first-year students, as a replacement for BASIC. Ummm, what? I don't think that's true.
- pjmlp 2y agoBASIC revolutionized programming. At least BASIC started as compiled language, despite being dynamic. Interpreters were mostly a thing on the memory constrained 8 bit home computers. 60 years ago!
- nextlevelwizard 2y ago> Not because it is fast or particularly good at anything it does. True. But Python is crucially fast enough and enough for everything. Sure, it takes 30x longer to parse the data the author has with a Python script than in <insert-a-compiled-language>, but sharing your Python script is easy as... sharing the script. The other party does not need to install anything or learn anything new. It just works. And at the end of the day this script just very simple and assuming the data isn't changing hourly - which I don't think corona virus is mutating that fast or at very least we are not sequencing it that fast - waiting even a minute for the data is fast enough. Often people complain that something is 10-100x slower with Python, but conveniently forgetting that spending a 1ms vs 1s on a thing you run maximum of once per week doesn't make a difference other than between your ears.
- tcfhgj 2y ago> Sure, it takes 30x longer to parse the data the author has with a Python script than in <insert-a-compiled-language>, but sharing your Python script is easy as... sharing the script. The other party does not need to install anything or learn anything new. It just works. The only thing which will just work is viewing the script. For execution, you first need to install the correct python interpreter. Probably you need to activate a environment, because the global one is incompatible. Then you need to install the dependencies, which hopefully are 100% specified and restricted to pip, otherwise you might run into hours of SAT resolving. For a compiled language, you need to install a Compiler instead of a interpreter or even nothing if you just get the executable. With a modern language and required dependencies, running the script in a modern compiled language is probably simpler than doing it with Python (e.g. cargo run takes care of fetching deps which python doesn't)
- xelamonster 2y agoThose issues are annoying but I'm not sure they're all that common. The default interpreter is perfectly fine for most cases as long as it's not years behind in versions, and I honestly have no idea where you'd get a Python dependency outside of pip, literally never seen one before. The company I worked for that did a lot of Python code had an internal Artifactory with a pip repo so even private packages went through it. Cargo is great, I agree it's approaching the usability of running a Python script there. But now you're compiling Rust, which is going to take orders of magnitude longer than any time you'd save from the script itself running faster. Plus for most of the scripts Python is used for from what I can tell, more time is spent writing them than running them anyways. So as much as I do love Rust I'm not buying that it's the better choice here.
- xelamonster 2y agoA lot of your points are valid but I disagree that Python is only popular due to network effects. I think it hit a sweet spot between expressiveness and accessibility that makes it attractive, and your point that popular libraries are often written in other languages to me just highlights another advantage: painless integration. You can get the speed of Rust or C code where it counts without the overhead of needing to write everything in those less approachable languages. I love how naturally it reads too--all the little details like allowing "is" and "not" in place of symbols add up to make it uniquely easy for my brain to parse. List comprehension in simple cases I find much more readable than equivalent implementations in other languages. Of course it's far from perfect, for example when those comprehensions start to get more complex they quickly become, well, incomprehensible. The ecosystem is pretty nice too, beyond just being large I find most of the packages I end up with are reliable and configurable enough to support many use cases. In comparison Javascript (an arguably more popular language) is a nightmare of awful syntax and unintuitive restrictions, with a hellscape of an ecosystem where even the most well-regarded frameworks feel half-baked at best.
- pnt12 2y agoI agree with all your points, except list comprehensions. I used to like them, but now refer the callback style from Javascript much better. Cannot auto complete at start: My auto complete doesn't work at the start of a list expression. In [for obj.abcdef...], what is obj? It cannot know. In a callback, using typescript , it knows: list.forEach((obj) => obj.acdef...): obj is an element of list, which, if typed, we can infer its value. It's minor but it's not optimal. confusing multi line comprehensions I don't know how to format this in HN, but this is pretty weird in multi lines: [obj.y \n for obj in my_list \n if obj.x >3 ]. Something like this reads much better: my List.\nforEach((obj).\nfilter((obj) =>obj.x >3).\nmap((obj) => obj.y)) I'm comparing with Javascript which I don't enjoy much either. But I liked using this style in C#, with the LINQ nodule.
- m_mueller 2y agoin a strange coincidence, SQL suffers from exactly the same issue due to select being before the from statement. I nevertheless still prefer list comprehensions over doing trivial things with map/reduce simply because it reads like math.
- TrackerFF 2y agoPython is good because the barriers of entry are almost non-existent. Of the widely used languages, it was the one that closest resembled to writing pseudo code. It removed a lot of friction, for people starting with programming. And since it has every library under the sun, that made it really easy for non-SWE people to use it as a tool. That is the reason it will continue to dominate the market. Until someone makes a language which is even easier to start with, Python will sit firmly on its throne. (My personal theory is that LLMs will become so advanced, that writing your spoken language will be the next, and that programming languages will kind of become abstracted away.)
- cyberpunk 2y agoIt's such a shame that it's more popular than ruby. It's such a better language overall.
- pansa2 2y agoRuby's object system is much nicer than Python's, but Ruby has plenty of warts of its own. For example: extremely complex syntax compared to Python's LL(1), overloaded constructs like blocks/procs/lambdas (whereas Python just has functions), and cryptic Perl-isms ($_ etc).
- Qem 2y agoAnother example, initial setup is beginner-unfriendly. No IDLE-like barebones editor provided out-of-the-box in the standard install, just the REPL. Anything beyond that you must figure out and configure by yourself.
- BiteCode_dev 2y agoMost rubists like the optional parenthesis, but I suspect must devs don't.
- thrdbndndn 2y agoI completely agree. As an amateur programmer, I started with JavaScript before moving to Python. Even now, many JavaScript patterns seem nonsensical to me. (/rant on) The infamous callback hell, the IIFE, and the default-to-async behavior (when using outside the browser), are look like anti-pattern to me in most of cases. I understand there benefits, I just don't think they're worth it. The syntax doesn't help either—after getting used to Python's simplicity, the excessive use of parentheses and brackets alone is off-putting. For something as simple as iteration, there are countless methods, yet none of which are particularly appealing (and I don't why someone thinks it's a good idea to have both `for of` and `for in`). You can't even iterate over some common object types without resorting to things like `[...someList].forEach` or `Array.from(someList)`. This should be built-in, even just as syntactic sugar. To make matters worse, a lot of professional JavaScript code seems intentionally written to resemble a puzzle rather than a straightforward workflow.
- pansa2 2y ago> It's popular because it's popular It's interesting - Python originally became popular because of the language itself, which led to the creation of libraries like NumPy, SciPy etc. But more recently, people come to Python for the libraries rather than for the language. The problem is that many of those people seem to be actively opposed to the philosophy that made the language popular in the first place, and want to turn it into something else. That's led to Python evolving away from "executable pseudocode" and towards the current rapid accumulation of poorly-designed features like ever-more-complex type annotations, walrus operators, and an insane version of pattern matching.
- bpshaver 2y agoI agree that Python doesn't need to get more complex, but I love type annotations. I think people sometimes complain about complex type annotations instead of considering that complex type annotations are just a symptom of a design that is more complex than it needs to be. In general, it baffles me that people treat type annotations as a hoop to jump through (commit messages like "mypy fixes" or "getting mypy to pass") rather than a constant source of feedback that, yes, sometimes encourages you to simplify your code.
- zarzavat 2y agoPython is good because it has batteries included. Other languages have taken a more idealistic approach of not including batteries. Python understands that programmers just want to get shit done without have to search what is the current hotness in XML parsing or whatever. Python understands that I don’t want to set up a package management environment for every tiny script I write. I can install a package once, globally, and then I can use it forever.
- arcanemachiner 2y ago> I can install a package once, globally, and then I can use it forever. I use pipx whenever I need to install Python packages globally. Other than that, it's virtualenvs all the way. I ran into some dependency hell a while back after globally installing Python packages with pip. Never again.
- pzo 2y agonot only about batteries included but even more about ecosystem of 3rd party libraries such as numpy, scipy, pytorch, onnx and other batteries build on top of that: opencv, open3d, mediapipe, pyqt, etc. and frameworks: django, fastAPI, fastHTML. At this point they are like C++ - not the most beautiful language and there are many better but ecosystem is too big to ignore.
- fire_lake 2y agoFunnily the recent Clojure release shows how to do this far better. Python packages are global (or global in a virtual env) and you need to install them before running your script. This is horrible! You should be able to lock down dependencies in the script itself, and they shouldn’t modify the global environment at all.
- zarzavat 2y agoHow does that work if you use a REPL? If I type $ python >>> import numpy as np >>> import pandas as pd Everything’s just there for me. I want my Python packages installed globally, Python is like a Swiss Army knife always ready for me to use. Yes you can do dependency management in Python, but I very rarely use it because Python is not so good as a language for software development. If I want to write serious code then I use a serious language with a serious type system. If I want to parse or download or analyze or automate or generate something, I use Python.
- 29athrowaway 2y agoIf you sell CPUs, or CPU usage, a slow programming language is great for business.
- bpshaver 2y ago"English popularity is self re enforcing. It's popular because it's popular. Not because it is concise or particularly good at anything it does. It arguably isn't that great for a lot of things people use it for. A lot of that popularity just stems from people already knowing it and the existence of lots of idioms and tropes. It's a bit like the Greek (if you are old enough to remember that being popular) of the casual conversation world. Lots of people use it that aren't necessarily very good authors or rhetoricians or even focused on that." This is just to say that yes, programming languages are like natural languages in this respect. In fact one of the key insights behind the development of Python was "code is read more often than it is written." I think once you internalize that idea it makes sense that programming languages would achieve popularity for the same reasons that natural languages do.
- fastasucan 2y ago>Not because it is fast or particularly good at anything it does Speak for your self. It's a great programming language that lets you utilize lots of great libraries. I have never understood this need to pretend that python sucks and that everyone using it is a bunch of dumb people following trends.
- pjmlp 2y agoAt least Visual Basic compiled to native code, starting with version 5. And by the follow up version, it was pretty much feature parity with C++, for userspace application scenarios.