[IPython-dev] Musings: syntax for high-level expression of parallel (and other) execution control

Darren Dale dsdale24 at gmail.com
Tue Sep 8 10:00:32 EDT 2009


On Tue, Sep 8, 2009 at 5:15 AM, Hans Meine<hans_meine at gmx.net> wrote:
> On Sunday 06 September 2009 09:14:46 Prabhu Ramachandran wrote:
>> Thanks for the interesting links and thread.  Just FYI, last year I had
>> occasion to solve, relatively elegantly, a set of pretty sticky problems
>> for mayavi2 using decorators and generators.  [...]
>> They allow us to do relatively simple but neat things very elegantly.
>
> Seconded.
>
>> The Kamaelia project (http://www.kamaelia.org) is also very interesting
>> for its use of generators, microprocesses, components and very
>> specifically concurrency.
>
> Let me throw kaa into the pot, which is a set of libraries for media
> programming, but kaa.base contains really interesting coroutine-stuff!
> Let me quote http://doc.freevo.org/2.0/Kaa:
>> The kaa framework includes a mainloop facility with an API for signals and
>> callbacks, timers, process and thread management, file descriptor monitoring
>> (with INotify support), inter-process communication, as well as a rich,
>> practically magical API for asynchronous programming (see
>> http://doc.freevo.org/2.0/SourceDoc/Async)
>
> Maybe the threaded decorator is similar to what Fernando has in mind:
> (I thought I mentioned kaa here before, but I guess I did not give any code
> examples..)
>
> @kaa.threaded()
> def do_blocking_task():
>   [...]
>   return 42

I think the pattern Fernando introduced would either throw away the
return value or it would rebind it to do_blocking_task, depending on
how kaa.threaded is implemented.

Darren



More information about the IPython-dev mailing list