On Mon, Mar 25, 2013 at 11:59 AM, Peter Westlake
<peter.westlake@pobox.com> wrote:
Understood that it isn't possible to use native asynchronous I/O. But an
implementation that used threads behind the scenes and returned a
Deferred (for small files) or a Protocol (for big ones) would be a nice
thing to have.
For streaming files, you want something pausable; there are existing producers which don't use threads, and there will presumably be a tubes equivalent. Maybe having the tubes one use threads by default is a good idea.
For getting a file as a string, you can just do:
d = deferToThread(lambda path: FilePath(path).getContent())
For more complex usage patterns, you'll probably want to write custom code using deferToThread/deferToThreadPool anyway.
--