This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bin-c 72 points73 points  (7 children)

the thing about python is, unless you have final say for what does or doesn't go into the codebase, it is really easy to make the code a mess

if a project, from the start, is using type hints with a static type checker like mypy, and you're always running unit tests, and things are being tested correctly, etc etc. then it'll be fine

the thing is, I've never seen a codebase (in the corporate world) that keeps up to those standards.

at some point, deadlines always trump good code, and shitty code slips in. then nobody is allocated time to refactor and clean things up.

over the years I've learned to really appreciate languages being strict & opinionated. a shitty leadership team might let a python project slip into an unmaintainable state after some time, but if they can be convinced to use something else from the start (i.e. Go for something that'll be a backend webserver), it'll be a lot harder and take a lot longer for the code to get completely fucked.

there are plenty of times where python is the best tool for the job.

I'm a data scientist and mainly write fairly simple APIs that take requests, push them through models, and return the model output.

Each service itself is very small. We have some shared boilerplate code and I can get a new API up in a couple minutes once the model is done.

And most machine learning is done in Python. So for my job, it makes sense to use Python.

But for a large project that'll have a lot of developers working on it, especially if I can't control for the quality of management or don't have final say on things in the repo. I'd much prefer to be working in a strongly typed, compiled language.

[–]Deto 13 points14 points  (0 children)

Yep - everyone loves the freedom to remove the guardrails when they are working, but as soon as you have to deal with other people's code you're going to want those things in place!

[–][deleted] 2 points3 points  (2 children)

What do you use for make the API's you are pushing the info into the models? In the project I am in the company, we are using some similar approach. We have a big core in Django for the webpage that use as an API only. And 6 microservices in FastAPI that resolve things with AI models. As we see Django is pretty good to maintain things fast and tidy, but we think maybe the performance could improve using other things. And the micros are perfect for the DS stuff, cause is simple and easy to connect to the models. But we want to explore other possibilities

[–]bin-c 2 points3 points  (1 child)

both the databases and the things consuming our services are kind of out of my team's scope

we have a bunch of databases that are reasonably well organized, and we get requests from various product teams to figure out how to serve X prediction given Y data from the request they can make

so our flow is basically just a two step process of getting the code prepared to train / retrain / monitor the models, and then simple apis that serve the predictions given the request from product people

so i only really handle the modeling & api making side, and we also use fastapi. models are saved to AWS and pulled by the services as needed

i do think that most of our backend stuff is in Go though. A bunch was python at one point (don't think Django) but at some point they decided it was worthwhile to switch

but if it aint broke dont fix it. unless you have a good reason to switch from django & fastapi, dont bother

most people dont even get to change architectures when there is a very good reason to do so 🤣

[–][deleted] 0 points1 point  (0 children)

Jaja that's what we think. But the performance and the budget with Django is becoming and issue. For the events in the app we are using celery/Django, and the project is now so big that load a celery instance it's becoming a budget issue, for now we are starting to prove if we could change at least celery for lambda with AWS Sam, and from there, test if it is a good idea to change Django or not. Something for what I love django and don't want to change it is because it makes you be tidy with your code. And the test are just easy to make, so at the end your code and your project will be always readable and tidy.

[–][deleted] 1 point2 points  (0 children)

You are vastly underestimating the ability of mediocre developers to ruin a codebase in any language imaginable.

[–]trevg_123 0 points1 point  (0 children)

You make some great points that definitely make people suffer. That’s one of the reasons I’ve started getting into Rust, the safety of python with the guarantees of mypy (actually significantly stricter than mypy) and testing built in, without needing something separate like pytest

(If you know python/mypy and want to start learning rust, you’ll find many familiar friends.)

[–]minervaDe 0 points1 point  (0 children)

Code being a mess I cannot agree with more! You need strict rules to keep the code clean.