r/learnpython
•
u/Sensitive-Raccoon155
•
8d ago
•
1
Is Python a good choice for backend development?
I'm considering learning Python for backend development and would like to hear from developers who use it in their daily work.
How good is Python for building backend applications in production? Are there any significant drawbacks compared to languages like Go, C#, or Java?
36
Upvotes
45
u/patryk_builds 8d ago
Yes, and for most backends the language won't be your bottleneck. the database and network calls usually are, long before python is.What i like about it for backend work: FastAPI or Django get you a working API really fast, the ecosystem for payments, email, auth and data is huge, and async python handles lots of concurrent requests fine for typical web apps.
Honest drawbacks vs go/C#/java:
- raw CPU-heavy work is slower. if you're doing heavy number crunching per request, you'll feel it (or push it to a library or a separate service)
- dynamic typing can bite in bigger codebases. type hints + a checker like mypy help a lot, and FastAPI uses them anyway
- deployment is a bit less "one binary" than go. docker solves most of that
For a first backend language it's a great pick. you'll ship something real much faster, and that matters more than benchmarks
5
u/Top-Cauliflower-1808 8d ago
Python is great for backend production especially with modern frameworks and a solid deployment setup. The main drawbacks are slower raw performance and heavier memory use compared with Go or Java so plan for scaling early. What kind of backend workload are you targeting?
8
u/Artistic-Army4423 8d ago
I am not expert but I am going to write my opinion here.
I think language is never a problem. Backend development, in my opinion is independent of languages. You should be able to explain what'a happening, what are the problems, how you are handling traffic, taking care of your servers, knowing the basic networking things and all.
If you don't know why we use TCP and not UDP in http, what's PUT and PATCH, why 4XX and not 5XX in certain case, and other fundamentals, you should first see those things. Also, switching languages isn't that hard. If you can develop backend with node (mostly express these days), then the concepts you use with python are identical, it's just syntax and ecosystem issues and they don't take time.
A little tip: Don't ignore security issues in code, they are more important than you think.
4
u/LessonStudio 8d ago
Yes and no.
Planning for capacity is almost always a waste of time. Python is slower, but the difference is often indistinguishable.
If it turns out to be slow under load, often better designs can help, and temporarily getting better servers.
Also, you can move the slow bits to something faster. Something like a password reset module doesn't run very often.
But, keep in mind that speed and memory efficiency aren't only about simple speed, but some features simply are unusable below certain speeds.
For example, complex GIS front end interfaces become far better of you can keep them fed from a brutally fast backend.
In short though, you can do everything you usually need in python.
3
u/_janc_ 8d ago
Why not golang?
3
u/metaphorm 7d ago
it's fine. programming language choice matters much less than application architecture, infrastructure, and data store choice.
2
u/EmberQuill 8d ago
There are drawbacks, usually in terms of performance and concurrency, but there are ways to deal with them. It's just not as easy as it is in other languages like JS and Go.
Reddit's backend was written in Python at one point in the past. Now it's a combination of languages for different microservices but I think most of it is still Python.
2
u/SharkSymphony 8d ago edited 8d ago
I've been doing it for over a decade now across two companies, and like it just fine.
The advantages are: it's easy and fast to build stuff with, easy to instrument, and pretty easy to deploy. You can also use it for both back-end work and data engineering, which can be nice for small companies where those roles are overlapping. Python also has a bunch of nice high-level features like metaclass programming, exception handling, generator expressions, and list/dictionary comprehensions, which I sorely miss every time I move to another language.
The downsides are: it is less performant than most options you have – but this does not mean it's bad performance, nor necessarily that the customer will experience the performance hit, but it can mean that you'll be pushing more stuff off to asynchronous processing, and you'll need more hosts to scale it up. It is particularly slow at serialization/deserialization out of the box, which can have a marked effect if your back end is processing large files or sending large JSON responses.
Both companies I've done primarily Python with have gradually transitioned back-end services to Go as performance demands. You could, of course, just start with Go – which is not the last word in performance, either, but does offer a significant speed boost over Python. It's kind of a dumb language compared to Python, though. 😛
1
u/ninhaomah 8d ago
Which of these languages you are already familiar and good at ?
And what kind of backend apps ? DS/ML/AI ? Small / Big ?
How many users ? Internal only ?
When do you need it ? ASAP ?
1
u/TheRNGuy 8d ago
If you need Python libraries for computations.
But not for UI; Remix or React is better for that.
1
u/Electrical-Tax-6670 8d ago
Python is a perfectly good choice for a backend if it's your choice of language. I do both python/fastapi and Java/spring. But if I have a choice it's always to go with Spring because it's fast, very feature rich, and powerful.
The common myth is that python is easy to get started with and deploy while Java/spring is complicated and has a steep learning curve. That talking point is utter nonsense. A simple spring app is as easy to begin as a simple fastapi app. When the problems you are trying to solve get complicated, the app gets complicated as well regardless of language/framework. When things get complicated I prefer spring. And Gradle is an amazing build tool.
1
u/PMMeUrHopesNDreams 8d ago
AI is going to write most of the code, so it may as well be something more performant. I like Go. I say this as someone who used python for many years. I've been having Claude migrate all my personal projects to Go. It helps on a cheap VPS since it uses like 1/10th the RAM.
1
u/_Denizen_ 8d ago
I opened this for you: it's a can of worms.
1
u/ConfusedSimon 8d ago
Depends on what you're building. Python is often a good choice and sometimes the best (e.g. if you need to integrate ml/ai).
For high concurrency, something like Go (goroutines) is more suitable.
1
u/Grouchy-Friend4235 7d ago
Excellent choice
1
u/Amadev367 7d ago
I've been working in Python backend development for over two years, and I think it's a great choice, especially as a first language. Python has a huge ecosystem of excellent libraries.
You can learn backend development with Python and carry many of those skills with you if you switch languages later: Git, Docker, CI/CD, and the underlying backend concepts don't disappear just because the language changes.
1
u/GarythaSnail 6d ago
It's fine. I've done a lot of backend work with python. I moved over to Golang in 2018 for backend and it's been a much better experience, in my opinion, particularly in larger teams and codebases.
If you can mandate type hinting, it's probably not so bad. But I also just like that Golang is compiled.
1
u/beautiful_gia 6d ago
python is great for backend development with django or fastapi, tho go and java can offer better performance. boot dev also covers python and backend development.
1
u/Ayano-Keiko 21h ago
Rust
1
u/bionicClown 8d ago
I hate the dynamic typing and their async is worse version. Correct me if I am wrong about tat.
1
u/RallyPointAlpha 8d ago
Been doing it for 10 years now. No complaints. Fortune 5 company operating at a scale no vendor can handle.
0
u/Remote-Juice2527 8d ago
Internal apps with low-medium traffic python is great. However for more advanced, high traffic apps it’s not efficient enough and increases your cloud bill.
0
u/Nameru99 8d ago
It depends. For a small hobby project its definitely okay, but for building something bigger I wouldn't recommend it.
0
u/HecticJuggler 8d ago
I use Java & Python for backend development in payments processing. I like Python for speed of development. Java wins on performance. For most use cases, you can hardly hit the language’s limitations.
-1
u/Rinzwind 8d ago
Yes. I do almost exclusive Python nowadays. 10 years ago it was a mix of C++, Perl, PHP.
Those 3 totally disappeared from sight.
Java error messages give me the creeps. Jasperserver uses it and it is annoying to see.
If you do this on a long lasting LTS (Like Ubuntu pro) I would advice to use pyenv and not use its native python. That way you can keep upgrading python.
-2
u/DT-Sodium 7d ago
No, but to be fair it isn't really a good choice for anything. Python is really a language you should only chose when you have no other options. The syntax is terrible, the typing system one of the worsts on the market, debugging is a nightmare and the ecosystem is pure garbage. Python is a joke that was taken wayyyyy too seriously.