Given node.js is known to be much faster while still offering the dev speed of a scripting language. I love python for algorithms and DevOps scripts but feel afraid of using for web as it might end up with huge cost for hosting (higher CPU power)
Given node.js is known to be much faster while still offering the dev speed of a scripting language. I love python for algorithms and DevOps scripts but feel afraid of using for web as it might end up with huge cost for hosting (higher CPU power)
Rather, it's the programming models put in place by the initial framework choices and architectural decisions that will make the biggest difference. Prototyping a web app in Python isn't fast because Python as a language makes it fast. It's fast when you use Django to effectively wire a database model directly to a set of CRUD endpoints in less than a dozen lines of code, complete with validation. The same can be said about Ruby + Rails.
Node could, in theory, provide a similar capability, but the platform was popularized after large sections of the developer community seemed to demonize frameworks like Django and Rails. So, whether for this reason or another, Node doesn't really have anything quite like Django or Rails, and thus would likely not match the dev speed of those frameworks, all else being equal. Python is _fast enough_, and early stage companies rightfully tend to not worry about CPU usage or hosting costs, because they don't have the scale for it to matter.
------
With all that being said: pick an early tech stack that helps you optimize for iteration speed, not necessarily raw dev speed (although they often overlap). Importantly, you typically want to build a system that minimizes the cost of being wrong in a reasonable time frame. If that's Python? Awesome. If that's Node? Also awesome. If that's Java? Awesome. Pick what you/your team know best and can architect in a sane way to help you find the balance between time to market and ability to experiment.
Look at https://insights.stackoverflow.com/survey/2019#technology-_-... Python is not on the list of most dreaded languages, but Javascript is.
1. fast development (both Python and node)
2. boring platform where it's usually OK to leave smth unupgraded for >5 yrs (Python wins here hands down)
3. cheap devs (good Node.js devs have a lot of option to "jump around" between front and back and frameworks so higher room for leverage ...with Python you can hire cheapest newly grads since it's now taught in most unis)
...on top of this:
- performance in terms of "requests served per CPU power" does NOT matter for most apps (and when it does caching saves most situations) - and if it does, modern Python can deliver now (async is mature)
- using same stack as ML and datasci comes as a bonus - you can have backend-full-stack-devs jumping between data pipelines, APIs/web, ML models, data analysis code etc. who can stay separate from frontend-full-stack-devs doing web frontends + mobile hybrid etc.
It would be great if we could also standardize on a static high performance language common to all (eg. usable for special-performance-sensitive-code either standalone services or Python-modules or node-modules) ...this area's a mess, too much overlap, duplicated work, and too hard for devs to jump from one ecosystem to another (Rust and C++ as lib/extension langs... Java/Kotlin or Go or C#/F# for standalone services... now Swift an option too...).
is Django or Flask async yet?
Short answer: no, bc FastAPI makes no assumption about your ORM (bring whatever, use none... your responsibility, your choice - I use sqlalchemy core + databases module for async support, no ORM, but but full use of Pydantic for enforcing schemas, just "divorced" from persistence layer, maybe you don't even need any), or your anything else.
I actively dislike DjangoREST and tbh Django too... but I admit that in combination they can save A TON of time when prototyping something.
If you code Python, at least take some time to read more modern code: see responder (not my favorite but cool), fastapi, starlette, asyncio http examples etc... Or see older examples (as old as Django) like web.py.
I suspect the response rate there is actually skewed high by the large chunk of students.
Regarding the CPU use and hosting cost, it's probably not an issue for most websites. Usually you end up database bottlenecked much sooner, and that doesn't kick in until you're on >100s of millions of rows.
> Given node.js is known to be much faster while still offering the dev speed of a scripting language.
Is this so? I consider python as a language and ecosphere far above javascript and nodejs. And how well can nodejs be optimized with non-js-code?
But regarding the numbers, likely it's because a python-shop wouldn't use nodejs and introduce an additional liability. Everyone usually chooses their prefered language and environment for a task as long as there is no significant advantage in using something different.
One can already use stuff like FastAPI [1] and Django is supposed to be getting async/await support later this year [2].
So that should make Python more competitive when compared to node.
While it get a big boost from the ML trend and these days has mostly finished displacing Perl in the "Non-bash operational scripting" department, there's still plenty of projects and users that have been happily or otherwise using it all that time.
But if I started today I would probably try to find some framework to do everything in JS/TS.
The real question is why someone like me should pitch JavaScript to my Django/Flask shop instead of technology with clearer competitive advantages: Elixir/Rust/whatever.
If I want better CPU usage I can get halfway there it with FastAPI and other Python frameworks.
CPU power is cheap and developers are not.
I don't think anyone is picking Python for it's type system. It's still a second class citizen at best.