Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > tasklet library based on PEP 0342

Reply
Thread Tools

tasklet library based on PEP 0342

 
 
charlie137@gmail.com
Guest
Posts: n/a
 
      01-19-2009
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...chy/tasklet.py
[1] http://www.async.com.br/projects/kiw...i.tasklet.html
 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      01-19-2009
En Mon, 19 Jan 2009 09:59:17 -0200, <(E-Mail Removed)> 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 http://www.velocityreviews.com/forums/(E-Mail Removed)

--
Gabriel Genellina

 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      01-19-2009
(E-Mail Removed) 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.

 
Reply With Quote
 
charlie137@gmail.com
Guest
Posts: n/a
 
      01-20-2009
On Jan 20, 6:37*am, Terry Reedy <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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
 
Reply With Quote
 
charlie137@gmail.com
Guest
Posts: n/a
 
      01-20-2009
On Jan 20, 6:37*am, Terry Reedy <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: concurrency program design stackless python tasklet or pythonthread? davy zhang Python 0 11-13-2008 03:28 AM
concurrency program design stackless python tasklet or python thread? davy zhang Python 1 11-11-2008 08:49 PM
Re: concurrency program design stackless python tasklet or pythonthread? Aleksandar Radulovic Python 0 11-11-2008 04:10 PM
About Rational Number (PEP 239/PEP 240) Lie Python 25 12-18-2007 06:13 AM
PEP for new modules (I read PEP 2) Christoph Becker-Freyseng Python 3 01-16-2004 04:26 PM



Advertisments