[Python-ideas] Flagging blocking functions not to be used with asyncio

Chris Angelico rosuav at gmail.com
Mon Oct 10 06:36:42 EDT 2016


On Mon, Oct 10, 2016 at 8:59 PM, Martin Teichmann
<lkb.teichmann at gmail.com> wrote:
> We would need to know whether the file descriptor we
> read from was created as non-blocking, or whether it was an actual
> file, and how fast the file storage is for this file (SSD: maybe fine,
> Network: to slow, magnetic disk: dunno). All of this is unfortunately
> not a Python issue, but an issue for the underlying operating system.

Probably not worth trying to categorize those reads by source.
However, one important feature would be: coming from cache, or
actually waiting for content? With pipes and sockets, this is a very
significant difference, and if you've done a peek() or select() to
find that there is content there, a read() should be perfectly legal,
even in an asyncio world.

ChrisA


More information about the Python-ideas mailing list