Re: [python-tulip] Async iterators

2015-03-24 Thread Guido van Rossum
On Tue, Mar 24, 2015 at 4:10 AM, Victor Stinner wrote: > 2015-03-24 2:44 GMT+01:00 Guido van Rossum : > > For seekable() I couldn't find any dynamic implemetations, > > The first call to io.FileIO.seekable() calls lseek(0, SEEK_CUR). > Oops. :( > It's safer to expect that any file method can b

Re: [python-tulip] Async iterators

2015-03-24 Thread Victor Stinner
2015-03-24 2:44 GMT+01:00 Guido van Rossum : > For seekable() I couldn't find any dynamic implemetations, The first call to io.FileIO.seekable() calls lseek(0, SEEK_CUR). It's safer to expect that any file method can block on I/O. If you doubt that syscalls can block, try unbuffered FileIO on a

Re: [python-tulip] Async iterators

2015-03-24 Thread Luciano Ramalho
On Mon, Mar 23, 2015 at 8:39 PM, Tin Tvrtković wrote: > f = yield from aiofiles.open('test.bin', mode='rb') > try: > data = yield from f.read(512) > finally: > yield from f.close() > > I've run into two difficulties - first, it's difficult for me to tell which > calls may actually block (d

Re: [python-tulip] Async iterators

2015-03-23 Thread Guido van Rossum
On Mon, Mar 23, 2015 at 4:39 PM, Tin Tvrtković wrote: > Hello, > > following the discussion from > https://groups.google.com/forum/?fromgroups#!topic/python-tulip/iGPv24gTpAI, > I've been working on a small library for async access to files through a > thread pool. I've been aiming to emulate the

[python-tulip] Async iterators

2015-03-23 Thread Tin Tvrtković
Hello, following the discussion from https://groups.google.com/forum/?fromgroups#!topic/python-tulip/iGPv24gTpAI, I've been working on a small library for async access to files through a thread pool. I've been aiming to emulate the existing file API as much as possible: f = yield from aiofile