[Python-Dev] Stackless Python - Pros and Cons

Thomas Wouters thomas@xs4all.net
Sun, 6 Aug 2000 23:05:45 +0200


On Sun, Aug 06, 2000 at 10:56:48PM +0200, Jack Jansen wrote:

> Could the defenders of Stackless Python please explain _why_ this is
> such a great idea? Just and Christian seem to swear by it, but I'd
> like to hear of some simple examples of programming tasks that will be 
> programmable in 50% less code with it (or 50% more understandable
> code, for that matter).

That's *continuations*, not Stackless. Stackless itself is just a way of
implementing the Python bytecode eval loop with minimized use of the C
stack. It doesn't change any functionality except the internal dependance on
the C stack (which is limited on some platforms.) Stackless also makes a
number of things possible, like continuations.

Continuations can certainly reduce code, if used properly, and they can make
it a lot more readable if the choice is between continuations or threaded
spaghetti-code. It can, however, make code a lot less readable too, if used
improperly, or when viewed by someone who doesn't grok continuations.

I'm +1 on Stackless, +0 on continuations. (Continuations are cool, and
Pythonic in one sense (stackframes become even firster class citizens ;) but
not easy to learn or get used to.)

> And, similarly, could the detractors of Stackless Python explain why
> it is such a bad idea.

I think my main reservation towards Stackless is the change to ceval.c,
which is likely to be involved (I haven't looked at it, yet) -- but ceval.c
isn't a childrens' book now, and I think the added complexity (if any) is
worth the loss of some of the dependancies on the C stack.

fl.0,02-ly y'rs,
-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!