Ask HN: Would you use Python as the main lang in a potentially large project?
I've been using Python for over 4 years from writing web applications for enterprise to startups in Django and Flask, and to RF test frameworks leveraging GNURadio. Python was a suitable choice for many problems I have encountered as because the ecosystem is extremely broad and it is very easy to get started, not just because the language is simple, but because of the popular "battery-included" frameworks. This means I can deliver value must faster from the beginning.
But having worked in a company which develops many different production systems developed over a period of 10 years, some running on platforms such as Debian etch, I can't help to think that had an enterprise language and ecosystem such as Java or .NET been chosen, maintenance and new features would have been significantly easier, because you hit performance issues much later and understanding legacy code bases are easier even if poorly written because of the static typing, and migration between different runtime versions is first-class.
I see Python (or similarly, Ruby) being used at large-scale at consumer-facing businesses such as Reddit, Digg, Uber, Dropbox, etc. but many eventually integrate to a JVM based language into their production system.
Would you advocate for using Python as the main language in a potentially large-scale project and long running standalone project? For people who have had the experience, it is worth using Python at the beginning and bearing the cost of adding another language and ecosystem in the mix when to support/replace Python when you hit scaling issues?
15 comments
[ 2.8 ms ] story [ 48.2 ms ] threadBut all 3 suffer from the same issues that dynamic languages have, and weren't designed for enterprise. Node.js is also being added to existing enterprise applications, but normally for anything web facing.
EDIT: Add opinion relating back to main question.
The main advantage of JVM and CLR for large scale development is support for static types. But, Python has a standard for type annotations (https://www.python.org/dev/peps/pep-0484/) which allow you to have all the language services which are available for static languages (refactoring, completion, etc) available for the Python. Not all libraries have these annotations, but you can provide it yourself, or separate code with annotations from code without annotations.
You should also take into account that JVM, and CLR have much better runtime performance than Python, almost on par with C++, so you should think about this if it's important for your app to use resources as efficiently as possible, but typically it's not as important for SaaS projects.
Would I recommend python for something the size I do now? No. I would recommend any other language that has strongly enforces types and compile time checks (like Java). They add an extra layer of safety on unit tests. I have dreams of rewrites that are in C# or Java.
Just today I fixed 2 bugs because of unexpected types being used.
This is the flaw in your thinking, the word Potentially. Good engineering means you worry about actual problems and not potential problems (within reason ofc). Your actual problem is that you haven't written the web application, so you do that first. For doing that, Python is an excellent choice.
"But what about web-scale?" Well, chances are your product will fail for some reason and never become successful therefore thinking about scaling problems now is a waste of time. In my experience, scaling problems comes much later than most people think. I've worked on an interactive site in Django that served 60k visitors per day without problems. It was the database that gave us the most performance problems not Python.
He has used python to write web applications.
I agree database has given the most pain to me as well may it be SQL or NSQL
Today, after some large projects, I miss strong typing but not enough to change everything. You need more tests, but I can live with it.
We integrated with a large retailer in a complex project with only two developers and I think Python was the reason to it. Too many open source things already done and fast iterations.
For other applications Python is way too slow... although PyPy helps a lot.
As for things like static typing and maintainability, it's certainly possible to do with Python. You also have the power to write horrible unmaintainable code. Unit testing tends to be much more more important in Python. And you can add static typing to Python these days, via external tooling.
Some ideas and tools for building long-term maintainable Python, originally written as guide for Java developers: https://codewithoutrules.com/2016/10/30/python-for-java-deve...
This is the key piece of information based on which I will give you my advice. If you know Python and use it already, then go build it in Python.
If you do grow to that level of scale, python will be the least of your worries. You will figure it out then. Just build in python and release the damn kraken.
But like others have said, it's tempting and typical for developers to obsess about details that at worse will be a good problem to have (... like having to super scale). Worth making sure you're not one of them.