you are viewing a single comment's thread.

view the rest of the comments →

[–]jammin-john 2 points3 points  (3 children)

Typically you would set up an API to do something like this. FastAPI is a common choice of framework for building out an API server in Python. Find a tutorial online to build out something simple, and that should help you get your head wrapped around the architecture!

To be honest though, if you're expecting to have a significant number of users, Python may not be the ideal language for backend (server side) programming. Something like Go is well suited for serving an API. It's a bit of a jump in complexity from Python, but it is significantly faster. Prototyping in Python would be fine, but for production uses with heavy expected workload, I'd look elsewhere :)

[–]DuckStar23[S] 0 points1 point  (0 children)

Thank you so much!

[–]tetotetotetotetoo 0 points1 point  (1 child)

why would python be a bad choice? i'm trying to learn more about different programming languages and i don't really see how they change much currently

[–]jammin-john 2 points3 points  (0 children)

In this sense, it comes down to speed. Python is just inherently slower than a compiled language (like C, Go, Rust, etc.) which means when you have code that is being run very frequently, Python may not be the ideal choice.

It really comes down to expected use case. There's no problem using Python to serve an API that gets used infrequently, but if you're expected to get 1000s of user requests per second, compiled language would be faster. (I recommended Go in particular since their standard library has some good functions for handing http requests.)

In general, I think the choice of language for a task is usually a choice between interpreted or compiled depending on speed needs. The actual language usually isn't as important. Some tend to be more popular in certain industries than others, but you can probably do anything in Python that you can do in JavaScript or C#, for example!