[Twisted-Python] So... Python 3.4 is getting its own async I/O system

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Mar 25 18:45:06 EDT 2013

On 07:47 pm, itamar at futurefoundries.com wrote:
>On Mon, Mar 25, 2013 at 11:59 AM, Peter Westlake
><peter.westlake at pobox.com>wrote:
>>Understood that it isn't possible to use native asynchronous I/O. But 
>>implementation that used threads behind the scenes and returned a
>>Deferred (for small files) or a Protocol (for big ones) would be a 
>>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
>For getting a file as a string, you can just do:
>d = deferToThread(lambda path: FilePath(path).getContent())

Not that `FilePath` is guaranteed to be thread-safe...

>For more complex usage patterns, you'll probably want to write custom 
>using deferToThread/deferToThreadPool anyway.
>Itamar Turner-Trauring, Future Foundries LLC
>http://futurefoundries.com/ — Twisted consulting, training and support.

More information about the Twisted-Python mailing list