[Python-ideas] How the heck does async/await work in Python 3.5
greg.ewing at canterbury.ac.nz
Wed Feb 24 16:00:29 EST 2016
> Suppose io_operation() takes 3 seconds, then how can I write something like
> future = io_operation()
> that print 'Start' immediately and the result of io_operation() 3 seconds
Yes, Python can do this, but you probably need to use real
threads. The only exception would be if io_operation() were
something you could fire off with a single system call that's
guaranteed not to block, and then wait for the result later.
Opportunities for things like that are rare in unix.
(Windows might be different, I'm not sure.)
More information about the Python-list