Re: [python-tulip] Why Tasks are not callable?

2014-04-24 Thread Guido van Rossum
Paul, I recommend that you take a step back and look at it from a different angle. If you have a coroutine that is waiting for you to tell it to run again, you should use a Future. The coroutine should use "yield from" on it, and in the other code, when you are ready to make it run, you call set_

Re: [python-tulip] list-style futures that can be used like generators

2014-04-24 Thread chrysn
(administrative stuff: my previous message seems to have gotten lost to the mailing list, thanks for fullquoting it). On Tue, Apr 22, 2014 at 10:50:26AM -0700, Guido van Rossum wrote: > I think it would be nice to iterate on this design a few more times > until it is general and robust and clear e

Re: [python-tulip] list-style futures that can be used like generators

2014-04-24 Thread chrysn
hello guido, thank you for your feedback (and for making asyncio real in general). On Sun, Apr 20, 2014 at 08:11:45PM -0700, Guido van Rossum wrote: > Here the pattern is somewhat simpler: there's no yield in the for-loop > header; also, the implementation doesn't need to hold back a value to rai

[python-tulip] Why Tasks are not callable?

2014-04-24 Thread Paul Sokolovsky
Hello, This must be FAQ, but: 1) google can't get search results right; 2) people gotta ask that again, again, and again, so here it goes. Why Task objects in asyncio are not callable? Just studying asyncio, it becomes clear that it's core is loop which runs callbacks from a queue. So, how do

Re: [python-tulip] list-style futures that can be used like generators

2014-04-24 Thread chrysn
(administrative stuff: my previous message seems to have gotten lost to the mailing list, thanks for fullquoting it. this message was not shown on the list either, trying to send it directly once more, sorry for the noise.) On Tue, Apr 22, 2014 at 10:50:26AM -0700, Guido van Rossum wrote: > I thin

Re: [python-tulip] Running different selectors in separate threads/processes

2014-04-24 Thread Guido van Rossum
On Thu, Apr 24, 2014 at 8:24 AM, Saúl Ibarra Corretgé wrote: > On 04/24/2014 05:17 PM, Jack Murray wrote: > > Apologies for digging up old thread. > > > > I notice that in python 3.4, asyncio spawns a new thread in this > > situation: > > > > print("Threading, before:",threading.active_count()) se

Re: [python-tulip] Running different selectors in separate threads/processes

2014-04-24 Thread Saúl Ibarra Corretgé
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/24/2014 05:17 PM, Jack Murray wrote: > Apologies for digging up old thread. > > I notice that in python 3.4, asyncio spawns a new thread in this > situation: > > print("Threading, before:",threading.active_count()) self._server = > yield from s

Re: [python-tulip] Running different selectors in separate threads/processes

2014-04-24 Thread Jack Murray
Apologies for digging up old thread. I notice that in python 3.4, asyncio spawns a new thread in this situation: print("Threading, before:",threading.active_count()) self._server = yield from self._loop.create_server(lambda: self, *self._address) print("Thread