tasklet library based on PEP 0342

C

charlie137

Hello all,

Using new features of python generators, as described in PEP 0342, it
is possible to write some sort of "tasklets" in a maner very similar
to stackless python, but running on cpython. For example :

@tasklet
def my_task():
yield Timer(10)
yield "result"

@tasklet
def other_task():
result = yield my_task()

other_task().start(callback=on_return)


I wrote an implementation of this in the scope of an open source
project for openmoko [0], there is also an other very similar
implementation from the kiwi project [1].

This kind of tool is very useful, but unfortunately there is no
standard library that would provide a unified way to use it
independently of the underlying event loop.

Does someone know if a similar library could eventually be added into
python standard libraries ? Would it be accepted as a PEP ?

Guillaume

[0] http://git.openmoko.org/?p=tichy.git;a=blob;f=tichy/tasklet.py
[1] http://www.async.com.br/projects/kiwi/api/kiwi.tasklet.html
 
G

Gabriel Genellina

Using new features of python generators, as described in PEP 0342, it
is possible to write some sort of "tasklets" in a maner very similar
to stackless python, but running on cpython. For example :
[...]
This kind of tool is very useful, but unfortunately there is no
standard library that would provide a unified way to use it
independently of the underlying event loop.

Does someone know if a similar library could eventually be added into
python standard libraries ? Would it be accepted as a PEP ?

Try the python-ideas list at (e-mail address removed)
 
T

Terry Reedy

Using new features of python generators, as described in PEP 0342, it
is possible to write some sort of "tasklets" in a maner very similar
to stackless python, but running on cpython. For example :

@tasklet
def my_task():
yield Timer(10)
yield "result"

@tasklet
def other_task():
result = yield my_task()

other_task().start(callback=on_return)


I wrote an implementation of this in the scope of an open source
project for openmoko [0], there is also an other very similar
implementation from the kiwi project [1].

This kind of tool is very useful, but unfortunately there is no
standard library that would provide a unified way to use it
independently of the underlying event loop.

Does someone know if a similar library could eventually be added into
python standard libraries ? Would it be accepted as a PEP ?

Start by listing your module/library on http://pypi.python.org/pypi
To ever get in the stdlib, it must be tested, used by several different
people, the best of its type, and relative stable.
 
C

charlie137

Using new features of python generators, as described in PEP 0342, it
is possible to write some sort of "tasklets" in a maner very similar
to stackless python, but running on cpython. For example :
@tasklet
def my_task():
    yield Timer(10)
    yield "result"
@tasklet
def other_task():
    result = yield my_task()
other_task().start(callback=on_return)

I wrote an implementation of this in the scope of an open source
project for openmoko [0], there is also an other very similar
implementation from the kiwi project [1].
This kind of tool is very useful, but unfortunately there is no
standard library that would provide a unified way to use it
independently of the underlying event loop.
Does someone know if a similar library could eventually be added into
python standard libraries ? Would it be accepted as a PEP ?

Start by listing your module/library onhttp://pypi.python.org/pypi
To ever get in the stdlib, it must be tested, used by several different
people, the best of its type, and relative stable.

I am afraid my implementation passes none of those requirement.
I will send a message to the python idea mailing list though. Thanks
for the answers.

Guillaume
 
C

charlie137

Using new features of python generators, as described in PEP 0342, it
is possible to write some sort of "tasklets" in a maner very similar
to stackless python, but running on cpython. For example :
@tasklet
def my_task():
    yield Timer(10)
    yield "result"
@tasklet
def other_task():
    result = yield my_task()
other_task().start(callback=on_return)

I wrote an implementation of this in the scope of an open source
project for openmoko [0], there is also an other very similar
implementation from the kiwi project [1].
This kind of tool is very useful, but unfortunately there is no
standard library that would provide a unified way to use it
independently of the underlying event loop.
Does someone know if a similar library could eventually be added into
python standard libraries ? Would it be accepted as a PEP ?

Start by listing your module/library onhttp://pypi.python.org/pypi
To ever get in the stdlib, it must be tested, used by several different
people, the best of its type, and relative stable.

I am afraid my implementation passes none of those requirement.
I will send a message to the python idea mailing list though. Thanks
for the answers.

Guillaume
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top