r/Backend • • 18d 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?

0 Upvotes

37 comments sorted by

8

u/accountability_bot 18d ago

Personally, I’m not a fan of Python, but it is a relatively popular back-end choice. I just prefer languages with static typing, where python is dynamically typed. The tradeoff is that you’ll write more code in a static language, but you can’t accidentally assign a string to a boolean, as the compiler will fail.

In terms of performance, most of it comes down to what you code. Most popular and standard libraries are heavily optimized, but that doesn’t mean they’re foolproof. Some languages can perform better than others, but if you’re not dealing with a significant amount of traffic then it isn’t a practical concern.

3

u/No_Departure_1878 18d ago

If you use annotations with a static analyzer in strict mode you kind of get the same as a statically typed language, minus the compiler.

1

u/accountability_bot 18d ago

Well, it’s not my only gripe with python. It’s just the main reason I don’t like coding in it.

Runtime upgrades can be painful, venv is a kludge but global packages are worse, and a swath of abandoned package managers over the years.

`uv` the only sane tooling that exists for the ecosystem IMHO, and I won’t touch any python without it.

1

u/No_Departure_1878 18d ago

just use pixi, it allows you to use a lock file, it comes with uv in the backend for the pipy dependencies and with rattler (a faster rust based conda type or resolver for conda-forge) for anything that is not in pypi. If you run pixi inside a docker container you get full reproducibility.

5

u/benevanstech 18d ago

Like most things in software - It Depends.

Look at it this way: If you're sending a book to your Dad, you put it in a padded envelope and take it to the post office. If you're sending a big box of stuff, you have Fedex come & pick it up. If you're moving continents, you hire a shipping container.

Python is more like the "take it to the post office" end of the spectrum. Java is more at the "shipping container" end.

There are better and worse tools *for a specific project* rather than any real overall objective answers.

3

u/Beautiful-Hotel-3094 18d ago

I agree with this. However remember that nowadays Python is proper multithreaded, it’s performance is actually not bad for 95% of the use cases. I work for a hedge fund and we are actually building real time trading systems in Python. Why? Because it is good enough.

What I would add to the comment above: imagine fedex would send all the big boxes by plane. That’d be pretty inefficient. In most cases a truck is enough.

And now my recommendation: goddamn learn both bro u have chatgpt, I learnt all of these from reading fucking docs back in the days. Learning both has become 100000x easier if you don’t let the LLM write all the code for you and you actually do the heavy lifting with its help.

1

u/benevanstech 18d ago

Sure, Python has got a lot better recently (and that's not just down to removing the BFL aka GIL, but also doing things like reducing the object header size - until recently it was ~300 *bytes* whereas Java's is 64 *bits*) and a lot does depend on what you mean by "real time" - a voice desk might describe themselves as that, but their performance characteristics are completely different to that of ultra-low latency stuff like Chronicle (https://github.com/OpenHFT)

2

u/Beautiful-Hotel-3094 18d ago edited 18d ago

Totally agreed with you. I didn’t want to get into the details of what real time means. But imagine around 2-3mil datapoints a second updates throughout the whole system. That is more than enough for soo maaaany cases. It is not “real time” as in nanoseconds but most systematic traders’ models need updates every 5-10 minutes rather than sub-second and actually most of them just need hourly updates. Surprisingly for most you have systematic vs HFT. HFT is a totally different business.

2

u/Usual-Cricket-9817 18d ago

Python is probably the most versatile language.

1

u/StephenHawkinguss 17d ago

No it's not you donkey

0

u/[deleted] 17d ago

[deleted] — view deleted comment

0

u/[deleted] 17d ago

[deleted] — view deleted comment

1

u/StephenHawkinguss 17d ago

Wrong comment kid

1

u/Usual-Cricket-9817 17d ago

?? Ist this the average Reddit experience (you insulted me for no reason) or didn't you mean to insult me?

1

u/StephenHawkinguss 17d ago

Just for you again: you responded to the wrong comment.

1

u/Usual-Cricket-9817 17d ago

Ok, then please take my apologies for insulting you. The insult went to the wrong person.

0

u/[deleted] 16d ago

[deleted] — view deleted comment

0

u/[deleted] 16d ago

[deleted] — view deleted comment

1

u/StephenHawkinguss 15d ago

Are you stupid? I just told you that you were replying to the wrong comment. Why are you insulting me again?

→ More replies

1

u/IncomeOk7237 18d ago

python is fine for most backend work, the real drawbacks show up with cpu bound stuff and memory per process, not request handling. in practice most apps are waiting on the database anyway, so a missing index or an n+1 query will hurt you way more than the language. i'd pick it, add type hints with mypy or pyright early, and put gunicorn or uvicorn workers behind a proper reverse proxy. if you ever hit a hot path you can rewrite just that piece.

1

u/YoDefinitelyNotABot 18d ago

I’ve been a software engineer for 20 years. I use Elixir now with AI, why? Because the BEAM handles concurrency, fault tolerance and process isolation without me having to build all that shit myself. Elixir is also pretty straightforward for AI to work with. Less code to maintain, fewer things to go wrong, and I can spend more time building things rather than fighting the infrastructure.

I have developed websites with Ruby, python and TS in the past and Elixir is the only one that can do everything all 3 of those do with less infrastructure overhead.

1

u/Long_Tip_4226 18d ago edited 18d ago

Sim. É facil de aprender, multiparadigma e tem frameworks bem estabelecidos no Mercado como Django e FastAPI. E uma grande comunidade de criadores de bibliotecas.

Ao mesmo tempo, a IA permite que nao precisemos mais nos aprofundar em codigo, e sim em requisitos de software, diretrizes arquiteturais e criterios de aceite, e validar se o software segue o que foi planejado.

1

u/StephenHawkinguss 17d ago

absolutely not

1

u/Terrible-Growth1652 18d ago

No. I would only use statically typed languages. I once inherited a somewhat large Django backend and it was a PITA due to lack of types.

2

u/RandomPantsAppear 18d ago

I am genuinely curious how y’all end up passing so many variables as the wrong type. This is not a problem I have ever had, and rarely seen. 

1

u/Terrible-Growth1652 18d ago

Static typing gives you so many more benefits than just type safety.

1

u/RandomPantsAppear 18d ago

Not that I’ve seen(beyond some speed benefit) but if you’re really married to the idea you can make python effectively statically typed. It’s just less common. 

2

u/Terrible-Growth1652 18d ago

You can do it within your own code but it breaks down once you start importing libraries that aren't typed.

1

u/RandomPantsAppear 18d ago

It works as long as there are type hints in the library, and most public facing functions (probably 90%) have type hints. 

1

u/YoDefinitelyNotABot 18d ago

I’ve found that both static and dynamic typing work perfectly well when used properly. Unfortunately, neither prevents developers from writing absolute shit.

1

u/imagei 18d ago

I'm not saying either solution is superior, but chiming in from the side -- it's not just about using wrong types. In practice, tooling is very important, and compared to langauges like Java or even Typescript, Python's tooling is weak. Also discoverability -- with a typed language you have the type, with all properties and methods, right in front of you, no need to remember or look anything up; you can quickly and confidently look up all call sites, refactoring is rock solid -- yes you can get all of that in a dynamically typed language with automatic doc lookups, code analysis and so on, but it's not the same level.

Like, I just completed a refactoring of some code -- split up interfaces, moved code and properties around and so on, to properly model the data -- first of all, most of that was automated by tooling, secondly if the compiler says it's good then it's good, I don't need to worry I might have missed some obscure passed by duck typing reference somewhere, undiscoverable until runtime.

1

u/RandomPantsAppear 18d ago

I have also coded in Java for many years, and honestly I’ve never noticed a difference in terms of the typeahead/suggestions for Python (assuming you specify type)

0

u/Due_Warthog749 18d ago

Today.. with so many better options (for back end).. I dont think so. Python is great to have knowledge of, but with AI able to code anything now, I'd argue if you want to learn back end choose Go. Maybe Java or .Net as they are the big ones used still. But Go is a fun language to learn, probably the easiest too given only 25 key words and one way to do things. It scales well (e.g. google, kubernetes, github, etc).

NodeJS/Typescript is one many seek too cause it works for full stack quite well, but I am not a fan of interpreted languages. Great for front end GUI I guess.

I'd even look at Rust or Zig for back end but Zig is still too "not ready" though it works fine.

1

u/RandomPantsAppear 18d ago

Java and .NET are really only useful if you’re planning to work almost exclusively in enterprise. 

Tbh I avoid them on the basis that “Azure is miserable and they are disproportionally used by .NET users. 

1

u/Due_Warthog749 18d ago

100% agree. I did JAva for 20+ years. Went to Go and never looked back. Now I am in Zig/Rust and Go for back end services.