Could you please stop posting unsubstantive comments to Hacker News? You've done it a lot already, and we're trying for something better than that here.
> Django 3.0 begins our journey to making Django fully async-capable by providing support for running as an ASGI application.
Bleh. ASGI is probably the worst implementation I can think of for a common async interface. Stringly-typed callbacks? async generators exist for a good reason. It's also very asyncio-centric, and asyncio is Not Good.
I don't often comment on HN, but I feel like this time I have to step up.
Having worked and developed with it extensively for over a year now, ASGI is one of the most elegant and well-designed interfaces I've seen.
Just wanted to address this:
> async generators exist for a good reason.
While the idea of using async generators might sound attractive at first, there's so much more to ASGI than exchanging messages in both directions.
Even on that aspect, I'd be interested in knowing how you'd achieve bidirectional communication async generators. How would the ASGI server call into the application and handle messages coming both ways? Surely, it can't just `async for message in agen: ...`, as that would only replicate the `send()` ASGI callback — what about `receive()`?
Besides, how would middleware look? Would it be as simple as wrapping `receive()` and `send()` into whichever other callable adds the functionality your middleware needs?
And you probably wouldn't be able to support all the possible syntactical implementations allowed by the notion of a Python callable: functions, classes, callable class instances.
So, yeah, I think ASGI is a beast.
Also, I wholeheartedly congratulate the Django team for pushing the standard out there and driving the Python async web ecosystem forward. You rock!
> Even on that aspect, I'd be interested in knowing how you'd achieve bidirectional communication async generators. How would the ASGI server call into the application and handle messages coming both ways? Surely, it can't just `async for message in agen: ...`, as that would only replicate the `send()` ASGI callback — what about `receive()`?
Yield is two-way. ``result = await agen.asend(next_message)` ` et al.
> Having worked and developed with it extensively for over a year now, ASGI is one of the most elegant and well-designed interfaces I've seen.
Having worked with Python async for 3 years, anything that asyncio touches is completely poisoned. ASGI is another in the line of terribleness of the modern async ecosystem.
> Besides, how would middleware look?
A second async generator.
> And you probably wouldn't be able to support all the possible syntactical implementations allowed by the notion of a Python callable
Require an async generator. Done!
> Also, I wholeheartedly congratulate the Django team for pushing the standard out there and driving the Python async web ecosystem forward. You rock!
Much like asyncio, something isn't good just because it's being pushed.
> Yield is two-way. `result = await agen.asend(next_message)` et al.
It's still limited. To get a result you need to send something. Using it for something that's not strictly request-response can get complex.
> Having worked with Python async for 3 years, anything that asyncio touches is completely poisoned. ASGI is another in the line of terribleness of the modern async ecosystem.
That's your own bias. I also used asyncio from the beginning and got a different opinion. The asyncio package that comes with python is low level and is meant for building frameworks. If you used aiohttp, asyncpg and other packages packages build on top of asyncio it's actually quite enjoyable.
I'd love to hear your suggestions for changes we could make while keeping it somewhat WSGI-compatible. It took a few years to refine it to where it is now, so it's not like we just threw something at the wall.
There's the problem. WSGI is fundamentally flawed too - it could also be using generators for a two-way communication channel instead of stringly typed callbacks.
In a world where Python has optional static type hints, it would be nice to have concrete objects passed too.
Can you expand on the stringly typed callbacks? Where are they required? Are you referring to string keys in a callback dictionary, in which case stringly-typed seems a bit of an odd choice of words.
It's convuluted, it's not structured concurrency (https://vorpus.org/blog/notes-on-structured-concurrency-or-g...), fundamentally despite being async/await a lot of networking code is based on callbacks anyway (see: asyncio.Protocol), and I've had a lot of trouble debugging code that spawn tasks because asyncio code has zero obligation to care about any of the tasks it spawns.
* You can absolutely stay within structured concurrency constraints using ASGI.
* The ASGI spec doesn’t have anything to do with asyncio. It’s purely an async/await interface - You can build against it just fine using other concurrency backends.
I've lost a small amount of weight whilst still entirely eating bread this year. The only thing food groups have to do with it is how filling everything is
> 99% of its dietary weight loss effectiveness is because fat is filling
This is pretty easy to disprove. It's not at all that fat is more filling.
Once your body starts to burn it's own fat you no longer feel like you're starving. Anyone whose fasted could tell you that, never mind been on keto.
The starving feeling comes from the period in between where your body is waiting for more carbs before finally switching to fat burning mode.
So it's not that fat is filling. Carbs are filling, too. It's just that when carbs are burned, there's nothing to replace them with, but when the fat you've consumed has gone through your system, and your body is already in Ketosis, it doesn't feel bad because there's weeks and months worth of food already on your body to burn.
I like of feel like it's easy to "prove" the opposite.
If I eat a meal comprised of fat and protein (2 fried eggs with some cheese, for example), I'll feel sated and won't feel hungry again for up to 5 hours.
On the other hand, it I eat a bowl of pasta, I'll feel very full immediately after eating, but am guaranteed to feel hungry again in ~2h.
I firmly believe that fat and protein are more "filling" than than carbs, and many people have shared similar anecdotes.
No boss, I can't meet that deadline, I'm too smart.