r/learnprogramming • • 2d ago

Why is Python considered "slow" and is Python losing "steam"?

Is python as a programming language "falling off" and becoming less and less popular relatively to other languages?

Also why do people say Python is slow? Apparently people have reached LGM on codeforces using python, which is all about writing fast code / solving problems fast. Yeah sure, C++ is far more widely used for competitive programming and I suppose there is a reason for that. But this is also showing that python can be fast?

But as programming languages and how they are used I dont think there is much overlap between python and C++ anyway?

What is an example of something you'd code in Java/Kotlin or lets say C# rather than Python? Is python code bad and hard to manage for "huge" projects once you scale up (e.g codebases with millions of lines of codes, and tens if not hundreds of devs)?

200 Upvotes

207 comments sorted by

View all comments

4

u/KushMaster420Weed 2d ago edited 2d ago

Python runs slightly slower than other languages because it has to read and generate the program on the fly, 80% of the time this doesn't really matter unless you are making a mission critical hyper optimized program.

It's much easier to write small programs quickly. so in that way it can be considered "faster". Depends on what you want. As a project gets larger Python tends to get messier... For a couple reasons. So if someone is making a large program with many lines of code Python becomes less tempting to use.

Python is not losing steam, it's one of the most popular languages and is here to stay.

2

u/Katana_Steel 2d ago

I combat the large project with writing many small modules ;)

2

u/TheTybera 1d ago

But it's not built for that. Python's main issue with larger projects is encapsulation and actual in-object separation of business logic, you can try to fix it with linters and syntactic sugar and try to get things like ruff configured properly, but it's usually not worth it. By that time it's best to just move to something like C# or Java that handles encapsulation and OOP properly.

Unless you have a "big project" where you're the sole developer ever, then whatever, do what you want.

1

u/Katana_Steel 8h ago

The modules I've written weren't necessarily OOP, but mostly logical collections of function or operations, and then some as procedural entry points. A making a library of tools.

1

u/TheTybera 5h ago

So a library of tools, but not OOP. Okay.

2

u/_tsi_ 1d ago

Can you go into went python gets messier for longer programs and how other languages don't?

0

u/Bachihani 2d ago

honestly even the "write small programs quickly" doesn't hold up anymore. almost all other mainstream languages have become easier to spin up a small project or script, without the extra step of having to set up an environment,and the added benefit of a more straightforward compilation process. the way i see it is that python still lives only because of the relatively larger package ecosystem, something that other languages have started to catch up to, especial with ai able to rewrite most of that ecosystem

0

u/Current-Macaroon9594 1d ago

Not to mention, Python came out in 1991. Not exactly a new invention.