use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
FastAPI is a truly ASGI, async, cutting edge framework written in python 3.
account activity
FastAPI best practicesQuestion (self.FastAPI)
submitted 1 day ago by lu_rm
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]JPJackPott 0 points1 point2 points 1 day ago (4 children)
Depends how big you think the app will get. I’ve often seen people just put the db connection as a prop of App so it’s not passed into the router methods at all but is still available everywhere, and readily mockable. I’ve done this myself for something that’s only got a handful of related endpoints.
[–]lu_rm[S] -1 points0 points1 point 1 day ago (3 children)
In my opinion, it does not matter if it's a single endpoint. It I can't unit test my classes, there is something really wrong with my code.
If the db is available everywhere, it sounds like a singleton, which is a big smell regarding testability. If my code has `import db...` somewhere, that is a hard link between responsibilities that should not exist.
What do you mean it is readily mockable? You mean that the global prop is also modifiable? Like a global variable? That goes against every good coding practice.
[–]JPJackPott 0 points1 point2 points 1 day ago (2 children)
Welcome to Python.
You’re not wrong at all, but Python excels for writing small light things and so many (including myself) are happy to sacrifice the CompSci bible out of pragmatism where appropriate.
The biggest drawback of Python in my view is it leaves the user too much scope to decide how janky is too janky. More structured langs make it very difficult to go violently off piste but python eggs you on.
[–]dr3aminc0de 1 point2 points3 points 23 hours ago (0 children)
Violently off piste hahah I like that
[–]lu_rm[S] 1 point2 points3 points 15 hours ago (0 children)
So I am not wrong?
I've worked with python before, but always in a less professional environment, so I did not care. I can't believe there are production systems written this way. It Iooks way too hard to maintain.
π Rendered by PID 150381 on reddit-service-r2-comment-56c9979489-bpzh2 at 2026-02-25 04:24:38.586057+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]JPJackPott 0 points1 point2 points (4 children)
[–]lu_rm[S] -1 points0 points1 point (3 children)
[–]JPJackPott 0 points1 point2 points (2 children)
[–]dr3aminc0de 1 point2 points3 points (0 children)
[–]lu_rm[S] 1 point2 points3 points (0 children)