[Stackless] Stackless Python and 2.2

Gordon McMillan gmcm at hypernet.com
Sat Dec 8 04:19:40 CET 2001

On 15 Nov 2001 at 7:39, Alex Russell wrote:


> The inclusion of generators implies (to my ignorant brain) that
> continuations (or some mechanism that allows for treating the frame
> state as an object) have been implemented. Am I wrong? 

That's correct - you're wrong. And not wrong, too.

Generators only go one frame deep (you can chain them up, but each intervening frame / function must know it's part of the chain).

Coroutines can span entire trees of code, with only the root & leaves having to know about it.

Continuations, like the 800 lb. gorilla, can do anything they want.

> How does this fit with Java's inability to implement
> continuations? 

Java doesn't even let you juggle with butter knives, let alone chainsaws.

> What does this mean for stackless in 2.2? 


> What do generators in the 2.2 proposal/implementation mean for
> stackless? 

One necessary condition has been met (frame objects know how to "return" a value without self-destructing). There are thornier ones (making the stack a 
tree, and dealing with interpreter recursions).

> Are they as efficient as generators written with
> continuations?

Dunno. I've mostly used coroutines. From that perspective, generators seem a toy. They're not, but they seem that way.

> Is it possible to implement microthreads this way?

No. Even coroutines can't (quite) do that.
> Oh, and is there status on stackless for 2.1 yet?

Dunno about that, either.

-- Gordon

Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list