News for hackers. Stuff that matters.
Re:Python Developers Survey 2019 Results by bogdan314 on Monday May 18, 2020 @06:06AM (#23220475)
web development seems to be twice as popular as ML use. Anyone knows why?

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)

Re:Python Developers Survey 2019 Results by colinmorelli on Monday May 18, 2020 @07:11AM (#23220940)
It's usually not the language itself that makes dev speed faster. Of all the time I spend building a reasonably sane Java app, the time I spend recompiling/restarting it is a small fraction.

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.

Re:Python Developers Survey 2019 Results by krzyk on Monday May 18, 2020 @06:34AM (#23220669)
Javascript & co is not the most popular among backend developers. I for example wouldn't even think about doing anything in it (or in Typescript).

Look at https://insights.stackoverflow.com/survey/2019#technology-_-... Python is not on the list of most dreaded languages, but Javascript is.

Re:Python Developers Survey 2019 Results by ezzzzz on Monday May 18, 2020 @10:06AM (#23222456)
Mention Python in a HN thread, and prepare for people to start moaning. IDK, maybe it's the SV filter bubble dealing with some mono-repo from google with a bajillion lines of legacy Python to support. Yeah, I can't imagine how unwieldy that might be. But for those of you that extol the virtues of the 'safety' a compiled language brings I say, try supporting a Java app that's been held together with shoe-strings and bubble-gum for 15+ years (in the enterprise world). Same nightmare, but much harder to re-architect.
Re:Python Developers Survey 2019 Results by aaai on Monday May 18, 2020 @07:38AM (#23221096)
Everybody's starting to figure out that to get affordable development you need:

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...).

Re:Python Developers Survey 2019 Results by nojito on Monday May 18, 2020 @08:10AM (#23221308)
>(async is mature)

is Django or Flask async yet?

Re:Python Developers Survey 2019 Results by aaai on Monday May 18, 2020 @01:04PM (#23225116)
Why do ppl like Django and Flask so much? They're heavy awkward dinosaurs with nasty codebases perpetuating really bad coding patterns (globals?! (multiple)inheritance-till-your-head-spins?! - that's what that soup of whateverMixins is, let's stop pretending... serializers that DE-serialize and different stuff depending on situation?! ...stuff you couldn't add type annotations too because the types would depend of calling contexts far away etc. etc. etc.).

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.

Re:Python Developers Survey 2019 Results by msluyter on Monday May 18, 2020 @09:11AM (#23221858)
Also, check out FastAPI, which is quite nice. Fully async with a lot of other nice features:

https://fastapi.tiangolo.com/

Re:Python Developers Survey 2019 Results by nojito on Monday May 18, 2020 @10:52AM (#23223057)
Does that have feature parity with DjangoREST?
Re:Python Developers Survey 2019 Results by aaai on Monday May 18, 2020 @12:57PM (#23225001)
...what would "feature parity" even mean? There's no universal checklist of api frameworks "required" features.

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.

Re:Python Developers Survey 2019 Results by pgjones on Monday May 18, 2020 @09:22AM (#23221972)
Re:Python Developers Survey 2019 Results by philote on Monday May 18, 2020 @08:35AM (#23221523)
Not that I'm aware of, but Tornado is a great async web framework. We use MongoDB and an ODM called umongo (that uses Motor for async, pymongo-like connections). I'm not sure what good async ORMs are available.
Re:Python Developers Survey 2019 Results by Kihashi on Monday May 18, 2020 @09:12AM (#23221861)
Re:Python Developers Survey 2019 Results by dbcurtis on Monday May 18, 2020 @10:07AM (#23222466)
Use Quart in place of Flask
Re:Python Developers Survey 2019 Results by GlennS on Monday May 18, 2020 @06:47AM (#23220765)
I think ML is a bit niche in terms of overall number of programmers doing it? Meanwhile, making websites has turned out to be very popular.

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.

Re:Python Developers Survey 2019 Results by slightwinder on Monday May 18, 2020 @06:56AM (#23220816)
I'm more surprised that ML is so widely used. Still quite special area IMHO.

> 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.

Re:Python Developers Survey 2019 Results by Pandabob on Monday May 18, 2020 @06:36AM (#23220678)
I'm no expert in the matter, but AFAIK, concurrency is becoming relevant in Python web dev.

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.

[1]: https://fastapi.tiangolo.com/

[2]: https://docs.djangoproject.com/en/dev/releases/3.1/

Re:Python Developers Survey 2019 Results by Macha on Monday May 18, 2020 @01:07PM (#23225177)
Once upon a time, Python's most common use was in web dev where it was basically the middle ground where you wanted something more productive than Java but more explicit than Ruby.

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.

Re:Python Developers Survey 2019 Results by black3r on Monday May 18, 2020 @07:02AM (#23220855)
I've started with Web Development in 2013. Back then Node.js was still in 0.x versions, Electron was basically non-existent and Django looked ten-times better than anything PHP was able to offer. I've dabbled with some PHP/Node/Java framework tutorials since then but haven't really had reason to fully switch.

But if I started today I would probably try to find some framework to do everything in JS/TS.

Re:Python Developers Survey 2019 Results by padthai on Monday May 18, 2020 @07:17AM (#23220972)
I started web dev in 2012 with a MEAN stack. Now I work with a LAMP stack. I deal with far less migrations and dead packages, but that's probably because Node.js was not very mature back then.

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.

Re:Python Developers Survey 2019 Results by pydry on Monday May 18, 2020 @06:10AM (#23220497)
python has a sane packaging ecosystem and type system.

CPU power is cheap and developers are not.

Re:Python Developers Survey 2019 Results by eru on Monday May 18, 2020 @06:32AM (#23220654)
TypeScript seems better (or at least on par) typing wise to Python.

I don't think anyone is picking Python for it's type system. It's still a second class citizen at best.

Re:Python Developers Survey 2019 Results by nojito on Monday May 18, 2020 @09:08AM (#23221818)
Common misconception. You have startups choosing a language while trying to absorb unsustainable operations costs to justify using the wrong language instead of picking the right language from the start.
Re:Python Developers Survey 2019 Results by salex89 on Monday May 18, 2020 @09:59AM (#23222376)
Until 7 years down the line you have to round up a team of your most experienced engineers and add some to figure out how to scale the frecking' thing.
Re:Python Developers Survey 2019 Results by jhayward on Monday May 18, 2020 @11:11AM (#23223310)
This is an outcome most startups pray they are lucky enough to see.