[Stackless] Stackless Digest, Vol 37, Issue 5

Andrew Dalke dalke at dalkescientific.com
Tue Feb 13 17:54:46 CET 2007


On Feb 13, 2007, at 5:26 AM, Andrew Francis wrote:
> Hello Andrew:

and hello Andrew.  :)

> Andrew, my first piece of advice is establish
> Stackless Python's unique strengths quickly.
> Consequently my first example would be that of a
> normal threading example and a tasklet example. Then I
> scale up the number of executing threads and tasklets.
> The audience will quickly notice the difference.

I couldn't think of a good example for that.  The
examples I came up with, like for parsing or network
I/O, didn't need 100s of threads.  Even if I was
writing a spider, my network speed would be the
throttle and not the number of threads.

The other examples I could think of, like a game,
were too complicated to explain in a slide or two.
The smallest example I came up with was Conway's
Game of Life but as all the cells are homogenous
there's no clear reason to use Stackless for that.

I'm not a game person.  Grant's tutorial does what
you suggest in his hackeysack code, but that's still
quite a few pages in.

I also think that if someone's doing game or actor
programming in Python then they are more likely
(in part because of EVE Online and Grant's tutorial)
to try Stackless.  I want to get others interested
in Stackless because of how it can be used in some
otherwise hard problems.


The advantage of my factorial example, which I'm
dropping for time's sake, is that it shows using
1000 tasklets, which would kill most machines if
replaced with threads.

>> Are the examples interesting to people (eg, XML
>> processing,
>
> Concerning XML. I think people would argue that one
> could use generators.

Really? There's no way I know to do that using generators.
It's going through the C stack because of Expat
so the callbacks can't yield control.

> Concerning the networking. I would state the
> fundamental problem with blocking I/O. Then I briefly
> discuss the solution. I would show an example using
> Twisted. Stackless/Twisted networking examples are so
> much cleaner and more productive.

But I don't know Twisted, don't know how to make a
socket module equivalent in Twisted, and don't know
of one that's ready for use like stacklesssocket is.

Can you help?

I also wanted to get people able to do basic I/O
without having to download other packages, and I
liked that I could build directly off of the asyncore
example for doing an http request.


>>    - am I missing something obvious?
>
> I think pickling is really cool. The pickling of
> execution state is the main reason I use Stackless.

And I recall Steve Holden's blog saying it was
amazing that the pickles worked across multiple
platforms.

What's an example of using it?  I couldn't think of
one.  I mean I could show it in action, as is done at
   http://www.stackless.com/wiki/Pickling
but I couldn't come up with an example that's would
be used in real code.

				Andrew
				dalke at dalkescientific.com



_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list