My opinion: Python may not be the best at everything it does, but it’s in the top 3-5 languages in the following areas:
- Very easy to install, write and understand
- Great libraries for a lot of applications
- Large community, lots of people with experience in it
It will always be a practical choice for those reasons. There are probably a lot more as well that I can’t think of at the moment.
Python is not the best at anything, but is the second best at almost everything. That’s the reason I use it. Everything I need to do, I know I can do it in python, maybe isn’t going to be the better or faster it could be, but it will work.
Yeah, Python is fast enough. Being assembly-fast is just not that important for a lot of things.
I would add its a easy Scripting language. No compilation problem, richer that shell/bash makes it a powerfull choice.
And a really dont like it.
It is far more then that. It is a full up programming language.
I never understand why people think compilation is a barrier. But sure most python is not compiled.
If compilation takes more than a few single-digit seconds, IME, it breaks the development flow when you’re working on small fixes.
Having worked on large C++ projects, the solution to this issue is using a good IDE with an LSP. But it is quite a regrettable situation because setting up an LSP can be a difficult, and they also tend to break quite easily. Understanding how to make an LSP work is an important productivity skill in those kinds of positions.
And ccache or ninja. Something that reduces the amount of stuff that has be rebuilt.
Interesting, I had never heard of ccache before, though yes, all good build systems (CMake, Ninja, etc.) should cache intermediate object files.
But the projects I was working on were so large that even binary and unit test executables were so large that even they would take ~20 seconds to link. You can’t use caching to alleviate that buildtime cost unfortunately.
Python is largely compiled. All the pieces of a compiler are built into how it processes things. Almost nothing works on an interpreter model anymore, where each line is parsed and executed before handling the next. Unix-style shell scripts are one of the very few exceptions. I believe JavaScript also starts being interpreted in the browser in order to start executing immediately, but then a compiled version is swapped into the runtime as soon as it’s ready.
Depends on what you mean by compiled. Python typically translates to meta code and that is interpreted. True compilation to binary runs about 100x faster. Python is slow though there are faster versions and ways around it.
I mean that there are successive steps to transform the entire code into tokens, the tokens into an AST, and the AST into some intermediary or final form.
True compilation to binary runs about 100x faster.
No, it doesn’t. Take a look at any of the number of projects that have attempted to compile Java to native code over the years. You’d be lucky to see any substantive gain at all. They sometimes have a use for packaging everything up in a single distributed binary, but you don’t do it for speed.
Things like C and Rust are fast because the language semantics can be compiled in a fast way.
We will have to disagree on that. This is all problem spectific, but I have found C code integrated via ctypes, cffi, or by a C extension is over 100x Python alone. Interestingly Python, Numba, and Numpy together which is a more pythonic solution can get to those speeds too.
All of the other approaches I have tried are much slower: Nuitka, Cython, Numpy alone, PyPy, etc.
To get best speeds one has to compile for your specific architecture and enable things like vectorization, auto parallel, and fast math. Most default builds including libraries do not do that.
This is all problem spectific, but I have found C code integrated via ctypes, cffi, or by a C extension is over 100x Python alone. Interestingly Python, Numba, and Numpy together which is a more pythonic solution can get to those speeds too.
Of course you did. Those are changing the semantics of the language. For example, things like Numpy store arrays more like how C does it than Python. That makes all the difference, not merely compiling to native code.
Python has essentially usurped BASIC.
Yeah, you can use it both for full applications (web or desktop) as well as simple scripts. The flow of getting from something simple to a full blown application is pretty smooth and natural - better than just starting out in Java or C++ and taking at least an hour before you get anything that runs.
Very easy to install
This has to be a joke.
Yeah, thought the same. Python isn’t intuitive to install new packages.
The libraries part is enormous. Researchers just pull up math engines, database access is a breeze, and so on.
You got a specific need, there is a library for it. It’s like C/C++ without the hassle.
Python is popular because it’s whitespace based syntax make noobs think it’s easy to read. This and it’s pre-installation on Linux made it popular amongst academics who embraced it for data analysis. This lead to a lot of data scientists embracing it and writing libraries for it which created a virtuous cycle in that arena.
And it’s a damn shame because Python, and it’s whitespace nonsense and lack of type system, is a horribly impractical language for building anything at scale.
White space nonsense. Yes and no. I do not enjoy tracking down white space issues until I remember the alternative. Matching brackets, writing begin/end statements, and worst of all looking at code that appears well indented until later you find it is not. and it runs totally differently then it looks. Similar issues with semicolons.
Pretty much everyone uses LSEs these days so frankly matters less either way most of the time.
Instagram’s back bone is written in python. I’d say that’s pretty scaled.
No, it’s not. It was rewritten in Facebook’s version of PHP when they bought them.
Here’s a blog post from meta, they introduced immortal objects to python to help with their Instagram scaling.
https://engineering.fb.com/2023/08/15/developer-tools/immortal-objects-for-python-instagram-meta/
Huh, TIL, I didn’t realize they kept the gateway servers in Python.
It does make it easier to read. We primarily use indentation to match brackets, so clearly, indentation is the most important readability feature between the two, not brackets.
Try reading the same piece of code: without brackets, and then without whitespaces and tell me which is better.
Whitespaces as syntax force you to indent your code properly and not be misleading.
Brackets are infinitely easier because any IDE (and most text editors) have a dead simple linting plugin which auto indents for you and lets you know when you fucked up. Your editor can barely do anything with whitespace only because everything is valid syntax.
Also lemme take this opportunity to say fuck yaml for exactly this reason.
I literally do that professionally, and I’m telling you that brackets are inarguably better.
You are used to whitespace; I have literally spent months refactoring and upgrading a react frontend and a python backend and am telling you that brackets are a single character and far more predictable, and then your IDE / Linter / Formatter can reliably use them to fill in the perfect indentation and whitespace.
My first professional language was Python, but I have since tried a half dozen others and would never choose to go back to a whitespace based language unless there was a good reason.
I’ve written C, JS, PHP, and a few others. Today I write Python almost everyday and wouldn’t trade it for any of them. Maybe Rust, but not because of brackets.
Typing thing is way over blown. What did suck before Python 3 was indeterminate type result from the / operator. You never know if it would be integer or floating division looking at the code. Now it is floating.
It’s not made for scale. Use C/C++ or something if you want scale.
Or you know, TypeScript, Go, C#, Java, Swift, etc. etc.
Python isn’t great at anything except for having a lot of data science libraries already written for it.
Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.
Edit: not all languages in the list.
When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.
Not only data science libraries, there is a library for about anything. Which is not the case for your list of languages.
Java has an excellent ecosystem for libraries. And a much more mature one in most cases than Python. The Spring framework alone is simply amazing.
Go’s ecosystem is pretty good as well and getting better.
When you understand how python works, it’s quite simple to use too, and has lot less clutter than say java or c#.
The problem is that many python devs consider things like “type hints” and “classes” to be “clutter”. It takes a lot of discipline to write managable python. Being “newb friendly” is a curse. “stringly typed” crap does NOT scale well.
It can scale though. It parallelizes really well if you use queuing systems to distribute the load. You just have to make sure that the hot loops are in C/C++, and it is very easy to interface with compiled binaries via the C API.
It can scale though.
So can assembly. But it takes a tremendous amount of discipline.
Python’s curse is that it’s popular with “newbs” who think it’s okay to use dictionaries for everything and that type hints are “clutter”.
Agreed. I have seen a lot of Python code that was really painful to massage back into a more structured object hierarchy. Java certainly does a bit better in that respect, and as a language, it does a much better job of encouraging better practices, but I think it’s also largely due to the kinds of people that use those languages as well.
Instagram runs on django.
It has optional typing
It has optional type annotations for use by linters*
Good point!
It’s kind of crazy how problematic pip is, though. There are enormous ecosystems like conda, poetry, arguably Docker all built around “pip not working right.”
I see so many people want to install vllm or something with like a 95% crash and burn rate if they aren’t already proficient with Docker, complete with the spare disk space to basically ship a whole other machine.
Meanwhile, massively complex Rust or Go or whatever packages… just work. With the native tooling, for me.
To be clear, I like Python, and I believe many issues can be smoothed with time (like improving its JIT and maybe encouraging more typing in codebases). But pip and its ecosystem are forever cursed.
People used to shit on npm all the time, and I believed them, because I didn’t have experience with anything else.
Then I tried pip. Holy…I had to beg npm forgiveness for ever doubting it
npm was bad, for a very long time. Then they fixed it, because they actually listened to other languages and did what they did. Python still refuses to do that. It’s quite insane because Ruby has had a solution for 15+ years at this point and Python could have directly copied it but refuses to. Python is absolutely the worst language I know of in regards to tooling.
Yeah.
I mean, npm deserves some healthy fear/skepticism, but everything is relative.
pip is easily the worst thing about Python. But now that we have
uvI would say the worst thing is the package/import system. I’m pretty sure only 1% of developers understand it, and it only really works properly if your Python code is a Python package.If you treat Python as a scripting language and just scatter loose files around your project and run them directly, it doesn’t work at all. Pain everywhere. Which is dumb as fuck because that’s like 80% of how people use Python.
Ugh yes I hate the import system too. I have to look it up every time and still don’t understand it, and it’s a hair away from messing up existing projects to the point where sometimes it does.
I want to love uv, but:
-
It breaks some random compiled C packages. I ran into this the other day, and the associated issue on the package was basically “shrug we see it’s breaking, this dev is doing some weird shit”
-
I’d prefer to use the optimized/patched build of Python CachyOS provides (and the optimized Python compiled system packages), though this is largely OCD.
-
It’s not optimal for some PyTorch stuff, which is its own little ecosystem nightmare
-
I’m glad it’s not just me lol every so often I’ll think “I haven’t done a python project in a while I’ll try FastAPI” or something and I have so many issues just getting the env set up.
It’s so ridiculous that many projects don’t even support pip+venv (much less system python packages. shivers). They literally check if that’s what you’re trying and pre-emptively fail.
Some projects become impossible to run in any combination because some dependency (looking at you, sentencepiece) no longer works outside a narrow set of circumstances, unless you hand build some obscure github PR, disable all the dependency checks and cross your fingers and hope the wheel builds.
And I’m sorry, but I don’t have 200GB of space, tons of spare RAM, and an intricate docker passthrough setup for every random python project. I just have like four different 3rd party managers (conda/mamba, uv, poetry… what’s the other one? Ugh)
uv. Is like cargo for Python.
It doesn’t work with some projects, unfortunately.
I think it’s just because it is always recommended as an “easy” language that’s good for beginners.
The only other thing it has going for it is that it has a REPL (and even that was shit until very recently), which I think is why it became popular for research.
It doesn’t have anything else going for it really.
- It’s extraordinarily slow
- The static type hints are pretty decent if you use Pyright but good luck convincing the average Python dev to do that.
- The tooling is awful.
uvis a lifesaver there but even withuvit’s a bit of a mess. - The package system is a mess. Most people just want to import files using a relative path, but that’s pretty much impossible without horrible hacks.
- The official documentation is surprisingly awful.
- Implicit variable declaration is a stupid footguns.
The actual syntax is not too bad really, but everything around it is.
syntax is bad for list operations, also there are situations where you need to count the number of parentheses you closed, which wouldn’t happen of you were able to use fluent interfaces
I think it’s just because it is always recommended as an “easy” language that’s good for beginners.
The only other thing it has going for it is that it has a REPL (and even that was shit until very recently), which I think is why it became popular for research.
If that’s the case, then why didn’t Javascript take its place instead? It’s arguably even better at Python in both of those areas…
But worse in everything else. And the runtime-platform is a mess.
I think Python is superficially easier since you don’t have to declare variables, printing is a little easier, etc. And in some ways it is actually easier, e.g. arbitrary precision integers, no
undefined, less implicit type coercion.But I agree JavaScript is generally a better choice. And it is actually more popular than Python so…
The blog gives a few vague answers, none of which shed any light on how Python became so popular. If I had to guess, much of it’s popularity came from being embraced as a data analytics tool – which is honestly a great use case for an interpreted scripting language – and its subsequent adoption by academia, introducing it to an entire generation of CS grads.
Python has advantages and drawbacks like any programming language. It’s not my favorite language and it’s not my least favorite. It’s not going anywhere anytime soon.
I would argue it’s because it is Good Enough. The most popular solutions to things are rarely the optimum ones but the ones that are generally applicable.
For example, I could fight with bash’s unpleasant syntax or I could do it more easily (but less efficiently) with Python. Would it be as performant? Absolutely not - but the performance gains wouldn’t be worth the time and maintainability.
From an administrator POV, python is great for scripting, automation, and AWS boto work.
In the Python documentary they mention the early creation of numeric as an alternative for closed options like Matlab; which led to Python being used in the sciences and data processing. Then later it became the natural choice for machine learning in the early 2010s and the AI explosion of 2020+.
Presumably because it minimizes developer time in writing code and is easy to use and it come with great libraries. That is why I have been using it since 1998.
Edit: People use to think I was crazy using Python. It was interesting seeing people slowly get a clue over the years.
It minimizes greenfield development time and increases it later for anything at scale. It’s the mongodb of programming languages.
deleted by creator
???
Yes sorry. Wrong thread. Someone was talking about AI somewhere. For Python, I agree with your comment.
That doesn’t sound like much of a “gotcha”. The requirements for small stuff and big stuff are drastically different.
Good thing python only gets used for small stuff then /s
…and people use MS Excel as a database, it’s not the fault of the tech that people force things to do things they’re not designed for.
You seem to think I’m saying python shouldn’t be used at when all I said was it increases development time for projects at scale.
Fair enough, it read to me as a “gotcha” (as in “if python is do great then why can’t it…”). I’ve spent too much time on places like Reddit where every interaction is three seconds from becoming a knife fight!
Reason I started using Python. C takes too much effort, Excel VBA is nut over 100 lines. Matlab or Python would be the next step. Matlab is nuts too in many ways.
I started doing CS50 way back when and pretty much bailed when it got to C. I could understand it but it felt like I had to build the entire universe to do the simplest of things.
I like that with Python I can knock something together quickly enough to justify the time it takes. Having to do something manual and repetitious at work? Knock out a Python script to make it less error prone in future. If it took a lot of time I’d just have to suck it up and suffer through.
But isn’t mongo webscale?? °O°
Because it’s actually good and also easy.
it’s as easy as the code you’re maintaining is.
it has fewer guardrails than most languages, that would prevent you from writing shit code
I’d say libraries is why it is popular. Also, I’m not a Python developer, and I don’t bother with libraries.
I started using it as an alternative to Octave/Matlab and Perl. Python is better at general programming than Octave/Matlab, and better syntax than Perl (IMO) while being almost as easy to do the same stuff I was using Perl for. It’s very good for quickly writing small scripts. Issues can arise on large projects/teams because of stuff like type safety, and it also has issues with performance.
Python is one of 4 key programming languages in world. C as a systems/performance/building block language (which I get has competitors). Javascript for node performance and web language. J as being the most powerful syntax/paradigm and best designed language.
Python has to be the most important due to all of the support it has, including C++ and other building block language/library imports that allows it to be the LLM integrator choice. A field that moves so fast, you couldn’t import libraries fast enough in another environment. Another shoutout to J is that its terseness is a good LLM fit due to less token consumption. But integrating with python is essential.








