tasklet library based on PEP 0342

Discussion in 'Python' started by charlie137@gmail.com, Jan 19, 2009.

  1. Guest

    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
    , Jan 19, 2009
    #1
    1. Advertising

  2. En Mon, 19 Jan 2009 09:59:17 -0200, <> escribió:

    > 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

    --
    Gabriel Genellina
    Gabriel Genellina, Jan 19, 2009
    #2
    1. Advertising

  3. Terry Reedy Guest

    wrote:

    > 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.
    Terry Reedy, Jan 19, 2009
    #3
  4. Guest

    On Jan 20, 6:37 am, Terry Reedy <> wrote:
    > wrote:
    > > 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
    , Jan 20, 2009
    #4
  5. Guest

    On Jan 20, 6:37 am, Terry Reedy <> wrote:
    > wrote:
    > > 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
    , Jan 20, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christoph Becker-Freyseng

    PEP for new modules (I read PEP 2)

    Christoph Becker-Freyseng, Jan 15, 2004, in forum: Python
    Replies:
    3
    Views:
    360
    Gerrit Holl
    Jan 16, 2004
  2. Lie
    Replies:
    25
    Views:
    717
    Dafydd Hughes
    Dec 18, 2007
  3. davy zhang
    Replies:
    1
    Views:
    401
  4. Aleksandar Radulovic
    Replies:
    0
    Views:
    400
    Aleksandar Radulovic
    Nov 11, 2008
  5. davy zhang
    Replies:
    0
    Views:
    388
    davy zhang
    Nov 13, 2008
Loading...

Share This Page