News for hackers. Stuff that matters.
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Friday July 01, 2022 @08:47PM (#31954887)
Why not the other way around?

What did Python have relative to other languages that inspired these developers to devote so much energy into their projects?

They could have chosen PHP, Ruby, Node, Go, Java, etc.

If I think back to ~2012 I remember that compared to other languages Python had:

1) Decent package management and "virtualization" (via virtualenv)

2) Nice balance of expressiveness and strictness

3) Was fun to write, hard to explain but it was the vibe

4) Decent enough performance for most things

5) Lots of developer tooling for debugging and stuff

It felt like the least messy of the scripting languages.

- Everyone knows all the issues PHP had, no need to list it all here

- Ruby was cool but there were a thousand ways to do the same thing

- Node was inheriting that weird web language with all its quirks

- Go was just in its infancy

- Java was the kitchen sink

Re:There are no open issues or pull requests on Flask by Semiapies on Saturday July 02, 2022 @05:09AM (#31957428)
"Back in 2012", Django was already 7 years old and had taken most of the market share of the first generation of Python web libraries and frameworks. This included that strange beast that was once considered the "standard" Python web system, Zope. Bluntly, Django had a much better development experience overall than the older web options.

(Mind you, the likes of Zope and CherryPy are still out there and under development. You just don't hear about them much.)

Up until about 2010, web dev in Python was converging hard on Django. It took Flask and similar small frameworks to bring back variety, and all of those had to meet the requirement of better than Django in at least some narrow sense, if only in being much lighter, to get any uptake.

Re:There are no open issues or pull requests on Flask by foxhop on Saturday July 02, 2022 @09:35AM (#31958863)
don't leave Pyramid out of the picture, it powers key infrastructure pypi.
Re:There are no open issues or pull requests on Flask by Semiapies on Saturday July 02, 2022 @10:59AM (#31959563)
There were many early Python web systems that are still in active development, so I kinda do have to leave someone out. But good call in mentioning Pyramid. :)
Re:There are no open issues or pull requests on Flask by mch82 on Friday July 01, 2022 @09:38PM (#31955218)
Python had PyPI and scientific packages.

It’s an attractive language for people who want to integrate existing packages into a solution instead of creating everything from scratch.

Poorly written software that correctly implements science/physics tends to be more valuable than expertly written software that encodes a science/physics defect.

Re:There are no open issues or pull requests on Flask by mch82 on Friday July 01, 2022 @09:40PM (#31955228)
People who aren’t software engineers don’t really care about exotic language features. They care more about packages, developer experience, documentation, tutorials, and how difficult it is to share code with teammates.
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Friday July 01, 2022 @11:56PM (#31956078)
I mentioned this in another comment below, but scientific packages were often ignored when building web services and APIs and that's the context in which Django/Flask were built.

At the time the scientific packages were extremely heavy and best avoided in production environments. Some people did it anyway but removed it once they needed to scale. Simply installing these packages was a huge pain and blocked one's ability to provision new machines, for example.

PyPI was indeed a big benefit. Ruby Gems are also what made Ruby so competitive at the time.

Re:There are no open issues or pull requests on Flask by code_biologist on Saturday July 02, 2022 @03:30AM (#31956983)
Slapping some scipy, sklearn, or pandas stuff into Django was a pretty workable solution even back when. Just want to sing the the praises. I've slayed a lot of normal size (as opposed to big) data problems with Django/Flask. Rub some JS charting on top of it and people thought you were a wizard.
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Saturday July 02, 2022 @04:20AM (#31957221)
Oh it was workable. Until it wasn't. I specifically remember extricating a high throughput web service from pandas. Having to scale made that stuff harder. If it was some app that a few thousand people were using, no problem.
Re:There are no open issues or pull requests on Flask by mch82 on Saturday July 02, 2022 @02:58PM (#31961412)
> If it was some app that a few thousand people were using, no problem.

You’re right, scale is absolutely an issue for companies that sell software or that are very large.

Also important to consider that most companies use software internally instead of selling b2b or b2c. Fewer than 500 businesses in the US employ more than a few thousand employees* (https://fortune.com/fortune500/2020/search/?f500_%20employee...) and there are over 17.5 million businesses (https://www.naics.com/business-lists/counts-by-company-size/).

* I may be wrong in my assumption that the Fortune 500 companies are the largest employers

Re:There are no open issues or pull requests on Flask by lambdadmitry on Saturday July 02, 2022 @08:59PM (#31964047)
Even then, scaling is an almost self-solving issue, as it usually comes with money attached, which buys quite a lot of engineering hours spent on scaling things. Overscaling in advance on the other hand with all of its associated complexity and slowdown killed many, many companies.
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Sunday July 03, 2022 @03:38AM (#31965873)
Inability to scale because the application was fundamentally unscalable has also killed many companies. And for those it didn't kill it significantly hurt their earning potential (and ultimately everyone's payout).

There's a balance and it's more delicate than people give it credit these days. Don't get me wrong though... over-engineering and/or premature optimization is just as bad. But there is an opposite extreme as well.

Re:There are no open issues or pull requests on Flask by twelvechairs on Friday July 01, 2022 @11:04PM (#31955759)
Ruby had all of your points 1-5. I don't think the difference was 'a thousand ways to do the same thing' (python has many ways to do the same thing also, and ruby's approach made it 'more fun') but some of the core libraries - especially things like numpy, pandas, scipy, etc. that both increased performance, simplified a wide variety of tasks and also attracted a broader range of users (mostly the 'scientific community').
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Friday July 01, 2022 @11:49PM (#31956036)
This is anecdotal, but my experience was that Ruby was fashionable in the wrong kind of ways.

For example...

Ruby doesn't have primitive data types. Everything, including strings, are just objects. This level of purity is quite nice and "cleaner" in a conceptual sense. Until you encounter a large codebase with hundreds of monkey patches. Or, something I saw a lot, the extending of "base" data types such as String.

I must admit that my memory is a little hazy here, but I remember that it was impossible to find language tooling that allowed me to "jump to definition" of anything I encountered. Ruby was so free-form with so much ambiguity that at the time it just didn't exist. I'm sure this has been resolved by now. In Python we had "Jedi" and other tools that worked really well for this purpose.

You'd be browsing a Ruby codebase, see `some_str.foo`, and wonder:

1) Is foo a method or a property? In Ruby a function call doesn't need parenthesis if it takes no arguments.

2) Where is foo? I don't remember it being part of the standard library. Where is it defined?

3) If I do find foo, did something else monkey patch it? How would I know?

4) If I need to pass an argument into foo, should I factor it out of String? At what point am I overloading a base class like String with too much functionality?

These are very real questions and the answers are important. Come across enough of these scenarios (remember this is just one example w/ Ruby) and you eventually give up trying to understand the codebase at that level. Everything becomes a black box, everything is magic.

Do these footguns exist in Python? Sort of. You can't extend primitive types and monkey patching doesn't fit so cleanly into a normal program (think of it as "friction"). There was less ambiguity in Python's syntax. And the language community promoted a list of idioms which was helpful for discouraging bad practices.

These things may seem subtle but they made a pretty big difference at the time.

> especially things like numpy, pandas, scipy, etc

These libraries were generally avoided when building web services, APIs, etc. The context of this discussion is Flask and the engineer(s) who built it were generally working in the world of live services. Dropbox, Reddit, and other YC companies made heavy use of Python as live service type software. Data analytics stuff def existed but different context.

The reason numpy and friends were avoided was due to the complexity of installing them. The dependency list was enormous and some of those dependencies needed to be compiled on the fly. Scientific packages also typically shipped with very large datasets to support whatever complex computing they were doing (think training data).

The 'scientific community' played a small part in the creation of the frameworks discussed here. If they did, it was more that Python was one of the first languages that the creators picked up in University.

Re:There are no open issues or pull requests on Flask by dragonwriter on Saturday July 02, 2022 @08:02PM (#31963689)
Ruby has comparatively crappy documentation (still does, arguably worse now because the Pickaxe is no longer updated), and also had a very weak non-Rails English-language community, but comparison to Python (by rumor, it had a much stronger Japanese language community, but I can't attest to that.)

If you were doing something nontrivial where the interesting part weren't the kind of things Rails/ActiveSupport addressed, those factors alone (before even considering language/library features) made it a lot more of an uphill climb with Ruby.

Re:There are no open issues or pull requests on Flask by nunez on Friday July 01, 2022 @11:57PM (#31956085)
Go and Node were infants back then

Java was (and still is) insanely heavyweight

Ruby was tied to the hip with Rails despite being more than capable on its own and being much more expressive than Python (IMO). Python is faster though.

PHP was (and still is) PHP

Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Saturday July 02, 2022 @12:51AM (#31956353)
We were shipping Go services all the way back in 2011! A bunch of my friends were working at other well known companies (of the time) and shipping Go stuff. Service based architecture was pretty popular and people were experimenting a lot.

Walmart picked up Node.js in 2012. Not for their core stuff obviously but they were running a bunch of internal services with it.

LinkedIn was evaluating it alongside Ruby (EventMachine) and Python (Twisted). They ended up picking Node for some of their services.

Highly concurrent green-thread-ish type stuff was all the rage. Go and Node were the front runners. Python was the conservative choice. Ruby was hipster choice :P

Re:There are no open issues or pull requests on Flask by seanp2k2 on Saturday July 02, 2022 @06:58PM (#31963266)
Love Ruby method chaining and .tap(). Ruby was the language I could most “think in” and write a lot of stuff then have it just work like I figure it would. Python makes me roll my eyes having to explicitly handle a bunch of random small errors, like it’s being overly pedantic. I’m also not a fan of significant whitespace, which is another reason I prefer JSON to YAML (along with always having to look up if I need a hyphen on a line or not).
Re:There are no open issues or pull requests on Flask by philsnow on Saturday July 02, 2022 @12:34AM (#31956268)
Ruby has Sinatra, which is much closer to Flask than to Rails.
Re:There are no open issues or pull requests on Flask by justsomeguy123 on Saturday July 02, 2022 @05:14AM (#31957449)
> What did Python have relative to other languages that inspired these developers to devote so much energy into their projects?

Not a popular opinion, but Python had Google.

Re:There are no open issues or pull requests on Flask by seanp2k2 on Saturday July 02, 2022 @06:54PM (#31963236)
Google App Engine was ahead of it’s time, but unfortunately not very good if you weren’t trying to write a webapp with the intention of scaling it on Google hosting.
Re:There are no open issues or pull requests on Flask by throwaway894345 on Friday July 01, 2022 @09:01PM (#31954969)
Sadly Python has stood still in the interim, focusing mostly on completing the migration from 2 to 3, by which point the competition was much farther along and continuing to innovate at a rapid pace (performance, package management, type system, tooling, etc).
Re:There are no open issues or pull requests on Flask by jonnycomputer on Friday July 01, 2022 @09:38PM (#31955219)
Honestly, I'm having a hard time buying this opinion. Python3 has changed a lot in the last 10 years, and much of those changes have been for the better.
Re:There are no open issues or pull requests on Flask by throwaway894345 on Saturday July 02, 2022 @12:36AM (#31956277)
I guess I’ll preface by saying I’ve been developing and operating Python services for about a decade, and I did a bunch of Python before that in various capacities. I’ve made a lot of money with Python, and I’m not one of the people who tars a language without having used it in anger.

Those changes have largely been incremental and/or questionable.

Python has async now, which is cool, but anyone calling a sync call or some poorly optimized algorithm anywhere in the stack can bring the entire application down.

Type hints are moving slowly in the right direction, but they’re still really cumbersome and mypy is still a pain to use (publishing type hints, recursive types, loading type hints, etc). Last I tried it (admittedly it’s been a year since I was deep in the Python game) it was still pretty beta quality.

Package management still sucks.

Deployment still sucks. Yeah, Docker helps, but it also makes some things worse, like local dev and build times and so on. And there aren’t many good solutions for distributing CLIs and other apps to users—some of the zip things work okay but they don’t close over the runtime, stdlib, or shared objects. Moreover, Python dependency zips can be huuuge—we were busting the 250MB lambda limit (compressed—this was back when lambda had a limit, pretty sure they upped/removed it since) meanwhile a comparable Go binary weighed in at 6MB.

Performance still sucks. Yeah, the 3.11 improvements will feel big to a Python programmer, but 40% (made up number) faster than 1000X slower than Go is still really slow (yeah, “just write the slow parts in C/Numpy/multiprocessing/whatever” works once in a while, but very often it doesn’t and it’s basically impossible to know from the project’s outset whether all of its bottlenecks will be amenable to that particular optimization).

So to summarize areas where Python has been left in the dust (probably an incomplete list):

* Performance

* Package management

* Static type system

* Deployment

* Async

Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Saturday July 02, 2022 @12:56AM (#31956386)
Async took forever too. Node was already being evaluated against Python/Twisted back in the early 2010s (and winning!).

Great point about package management. Go already had it figured out. Node was busy figuring it out (npm shrinkwrap; still sucked but less so).

Any time I talked to people about Python the conversation was about 2to3 and core team drama lol

Re:There are no open issues or pull requests on Flask by eptcyka on Saturday July 02, 2022 @04:37AM (#31957299)
Go really didn't figure package management until very recently.
Re:There are no open issues or pull requests on Flask by throwaway894345 on Saturday July 02, 2022 @10:55AM (#31959513)
Well, 2018, or about 6 years after 1.0. Granted it took some time to polish rough edges and get the ecosystem moved over to it.
Re:There are no open issues or pull requests on Flask by physicsguy on Saturday July 02, 2022 @02:24AM (#31956744)
And on top of that, if you’re using Django, async support is still incomplete and will be for at least another year
Re:There are no open issues or pull requests on Flask by lambdadmitry on Saturday July 02, 2022 @08:53PM (#31964013)
I was pondering this for quite a while, and overall I'm struggling to see why would it be more than "nice to have". Minor performance gains that very few companies would actually need? That's pretty meh. Chats and SSE and reactive stuff? Even with async, django doesn't fit those applications well. Other than getting on with the cool kids, why do you feel that async support in Django is particularly important?
Re:There are no open issues or pull requests on Flask by 0xFACEFEED on Sunday July 03, 2022 @03:51AM (#31965921)
You are 100% correct.

For the types of applications built with Django, async is actually more of a hinderance than a benefit. Async I/O can create massive back pressure in a distributed system.

A simple example would be a web service that gets a massive influx of traffic (organic or DDoS, doesn't matter). If the web service is using async I/O to manage database connections with an unlimited connection pool (often the default) then it will happily accept all incoming requests and push all of that pressure onto the database. The database gets overwhelmed because it's inherited all of that traffic. The database starts refusing connections not just to the web service but any service that connects to the database. And boom, you have system wide outage.

Obviously the database should guard against this kind of overwhelming traffic but that's often thought about last.

Diagnosing the problem becomes a lot harder since your bottleneck is further downstream. It gets messy.

Synchronous services on the other hand create a nice throttle. Your Django app is never going to achieve the kind of throughput that your database will. So, by design, your Django app will get overwhelmed first because it won't accept new connections (eg: maybe it runs out of memory).

That being said I still think it makes sense for Django to support it. Not for a chat app, but say... web sockets. You may want a websocket connection that pushes notifications back to a single-page-app. The notifications will contain a bunch of contextual data that the Django framework provides easy access to (think ORM, templates, etc). Obviously you could build the websocket thing as a separate service but then you lose all the goodies that Django provides to you.

Re:There are no open issues or pull requests on Flask by throwaway894345 on Saturday July 02, 2022 @10:43AM (#31959402)
Same with many SDKs. I haven’t looked into it recently, but IIRC there is mo official async AWS SDK. I’m pretty sure there also is no async Kubernetes SDK either.
Re:There are no open issues or pull requests on Flask by jimnotgym on Saturday July 02, 2022 @07:00AM (#31957945)
Has node got it figured out.

"Delete node-modules and try again" seems to be all to common in our developer chat system

Re:There are no open issues or pull requests on Flask by seanp2k2 on Saturday July 02, 2022 @07:08PM (#31963341)
The whole Node “works on my laptop” thing can be mostly resolved by ensuring that unit / intg tests run as a prerequisite for merging on a separate CI system with a clean (as in no existing node_modules) build workspace each time. It’s almost always down to bad package.json / package-lock.json practices // mixing in global packages.
Re:There are no open issues or pull requests on Flask by seanp2k2 on Saturday July 02, 2022 @07:04PM (#31963310)
F-strings and defaultdict make me dislike Python about 50% less. Date math still sucks compared to JS, and comprehensions tend to be less comprehensible reading code someone else wrote, but Python wasn’t really meant to be a functional lang.

All that said, I strongly believe that solving the right problem and working in a language that more of the dev team / company are comfortable with deploying / supporting / integrating with are way more important. I’ve seen far too many times what happens when a team at a BigCo “goes rogue” and wants to use something nonstandard, then has to re-solve dozens of solved problems because of that decision. It’s never been worth it in my experience. M

Re:There are no open issues or pull requests on Flask by Nextgrid on Friday July 01, 2022 @11:07PM (#31955776)
At the time, Python was the best choice, and nowadays since Python has all these frameworks that solve the problem there's less demand for an alternative in a different language if you can use the thing that already exists and has over a decade of battle-testing.
Re:There are no open issues or pull requests on Flask by garfieldnate on Saturday July 02, 2022 @07:47PM (#31963599)
Core Python didn't include pip until a few years after that; package management with Python in 2012 was a confusing mess.
Re:There are no open issues or pull requests on Flask by LesZedCB on Friday July 01, 2022 @09:52PM (#31955309)
it has that xkcd comic.

no joke.

Re:There are no open issues or pull requests on Flask by krallja on Friday July 01, 2022 @10:08PM (#31955410)

    import antigravity
Re:There are no open issues or pull requests on Flask by LesZedCB on Friday July 01, 2022 @10:47PM (#31955655)
exactly. check this out:

https://trends.google.com/trends/explore?date=all&geo=US&q=%...

see the inflection date? end of 2007. guess when that comic[0] was published

2007-12-15

mic drop

[0] https://xkcd.com/353/

Re:There are no open issues or pull requests on Flask by krallja on Friday July 01, 2022 @11:30PM (#31955932)
It definitely had a minor positive effect on my feelings about learning Python later, when I was offered the professional opportunity.