Hacker News new | past | comments | ask | show | jobs | submit login

I don't know much about Python's async tools, but why couldn't that be done in a non-async view?

In pseudo code I would think it would look like this:

    def my_view(request):
        name = async_get_name() // returns a promise
        city = async_get_city() // returns a promise
        waitUntilResolved(name,city)
        return HttpResponse('Hello '+name+' from '+city)



It could be done with anything, but async view lets other code execute while it is waiting for IO, what does waitUntilResolved do?


waitUntilResolved() would wait until the promises are resolved and of course let other code execute meanwhile.


It sounds like your waitUntilResolved() function is effectively asyncio.gather(), which due to the nature of Python’s async implementation is not something that could be used in a Django view prior to this release.


That's an awesome function. Is it multiprocess?


It was pseudocode.

If a function like this exists, it would just sleep until the given promises are resolved. I don't see how that is realted to the term "multiprocess".


Well I don't really see how it can exist, do non-blocking io and wait for promises while performing a sleep. So the only way left is multiprocess.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: