r/learnprogramming • u/Sensitive-Raccoon155 • 16d ago
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?
2
Upvotes
9
u/pak9rabid 16d ago
Python with FastAPI, and writing things to take full advantage of asyncio isn’t a bad route to take. I’m doing that now with good results.
4
u/Rafadazdoit 15d ago
Python is good for early prototypes, but it’s dogshit for long term, usually for long term I’d recommend Rust or C++
3
u/Pale_Height_1251 16d ago
It's OK but I'd prefer Go, C# or Java.
3
u/Human-Possession135 16d ago
Yeah for most things python is fine. Django is easy to learn and forces you to do things right.
Given you sound like a beginner and not someone scaling to 1 million users right now. Don’t sweat it.
6
u/rcls0053 16d ago
It works. It's easy to learn. There's frameworks like Django etc. that enable you to get started fast.
But I would not recommend it for any enterprise for backend services. Not having type safety in your application is an absolute pain. It's a fine language for certain use cases, but I just wouldn't build anything big on top of it really. Unless you set up strict rules for proper type hinting in your codebase and ensure it's followed. But imo there's just better languages and platforms for that.
2
u/TheSilentFreeway 16d ago
as your traffic isn't very high and you don't care much about performance or memory efficiency. it's good for quick prototyping and iteration.
2
u/razorree 16d ago edited 16d ago
check job offers in your area. I know a few companies that use python in backend, even big, well, I work ever for one currently (however I don't like it, it's an abomination that starts to bite in the ass, but no-one wants to admit it and switch language or start creating microservices, and it's about the time. I worked with Java/Kotlin for >15y before. Instead monolith is slowly rewritten to asyncio (so everything is mixed), a lot of code is run in separate cron launch deployments, the whole stack takes like 1-2TB of RAM ...).
Java/Kotlin - one of the most popular? (for bigger projects)
Go - a bit less popular
Python - maybe for smaller companies?
2
u/smichael_44 16d ago
Everything depends…
For me, I work at a privately-owned aerospace/DOD contractor with ~4k employees.
We have a couple python backends that see ~400 DAUs and barely ever eclipse 4 RPS.
We have a .NET app that sees ~1500 DAUs and never gets above ~15 RPS.
For most companies, anything works. A better question imo is, are you learning to solve problems? Solving a company’s problems with technology is what matters most.
5
u/fixermark 16d ago
Yes, it is.
I've used Python as the language for a decent-sized service on top of postgres (sqlalchemy, alembic for migration, and then strawberry for the API). It works well, though if you scale up a lot you might start to get sensitive to the trickiness around multithreading (and you generally fix that by just spawning more instances of the service app and putting them behind a load balancer). Modern python is also type safe if you include a static analysis pass and wire it up correctly.
Java I generally dislike for this application because ORM bindings in Java are so much inscrutable compile-time magic that I don't want to learn it. Go and C# I have no opinion on in this space.
3
u/DanKegel 16d ago
Supply chain issues make security a problem.
Consider golang instead, it's easy, fast, strongly typed, mostly mystery-free, has a great standard library, and has a fairly secure supply chain, partly because you can usually get by with the standard library more often than you can with Python or JS, partly because its package infrastructure was designed later and is more modern.
2
u/StewedAngelSkins 16d ago
Yeah it's fine. Only real drawback I can think of is it's a little less suitable for doing highly scalable microservice stuff, because the base container size needed to run a python app needs to be bigger and your options for RPC are less clean than what you get with Go. But unless that's specifically what you're doing, python is perfectly fine, and a common choice for backend code.
2
u/Evening_Vegetable218 16d ago
It's absolutely fine for most things you will need to do. Python is pretty easy to learn and there are plenty of resources to make this even easier. Once you're proficient you will be able to pick up other languages really easily
1
u/Sh3llSh0cker 15d ago
Python is great for automation and server side related ops https://github.com/elysiummachines/python
also a simple google search or a llm can tell you the same thing. just FYi.
1
u/sydridon 15d ago
Even though it's very hard to learn but I would go for rust. AI is very good at it and can help a lot if you are stuck.
1
u/engineeringsmudent 15d ago
Python’s pretty nice imo. FastAPI w/ SQLAlchemy is a great set up for building a basic backend. Being able to use pydantic models for input validation is also very nice.
Sometimes it’s alright to optimize for developer experience and ease-of-use. Not every piece of software needs to support high speed or throughput.
Have used Python quite successfully for basic backends controlling physical hardware components in specialty use cases. Using a more performant language would’ve meant longer development times and more complexity that just wasn’t needed.
All about picking the right tool to solve your particular problem.
1
u/andycwb1 12d ago
It’s a very subjective area, and also has lots of unless X, or because Y dependencies on the right answer. People obsess too much about which language. Learn to program, then learning a new language takes a few days (more these days because of the enormous amount of standard library functions available). At one point I was learning about 5 different languages simultaneously as part of my Computer Science degree - the idea was to make you think independently of the programming language you’re writing.
1
u/the_house_blend 10d ago
I guess it depends on the jobs in your area. Usually Java, C# and Node JS are the most used. I’m a Test automation engineer and I started with Java and used Selenium, then latterly Typescript with Playwright. I picked up python at some point along the way, for writing little utility scripts because it’s good for automating things, but that’s all I really use it for.
1
u/ialiimran 10d ago
I would definitely recommend learning Python. But just don't choose a language based solely on the benchmarks. Choose the one that fits the systems you want to build.
1
u/bunnypaste 16d ago
My backend is all .sh, .py, and postgresql.
1
u/SharkSymphony 16d ago
Cross-posted from r/learnpython; more answers there: https://www.reddit.com/r/learnpython/s/cqgNQUVwrK
0
u/Poincarina 11d ago
I am working on a legacy Python 3.8 Flask backend currently. Spring (Java) is just so much better and mature framework wise. I would never choose Python myself for a backend
0
u/palinurosec 16d ago
no, it's very slow. if you are looking for something easy, simple, fast and easy to maintain in the future, go with go
-1
u/az987654 16d ago
Not in a real world production application
-2
u/MacaroonOk9376 16d ago
Just here to say C# is a great choice. Depending on where you're located, there will be a shit ton of C#/.Net jobs available.
17
u/[deleted] 16d ago
[removed] — view removed comment
50
u/[deleted] 16d ago •
[removed] — view removed comment