[Python-Dev] Stackless Python

Christian Tismer tismer at stackless.com
Mon May 31 20:09:08 EDT 2004


Martin v. Löwis wrote:

> Bob Ippolito wrote:
> 
>> I'm believe that map and filter are non-recursive

They have been. They can be, again, but why.

> Can you point me to the code that demonstrates this? Looking at 
> Stackless' src/Python/bltinmodule.c:builtin_map, I see
> 
>         for (i = 0; ; ++i) {
>         ...
>                 value = PyEval_CallObject(func, alist);
>                 ...
>         PyList_SetItem(result, i, value)
>         ...
>     }
> 
> which looks recursive to me.

Yes. trying to do a minimalistic approach, I dropped all
non-recursive implementations of non-trivial things (meaning
non-tail-recursive things) which were not absolutely necessary.
And since we have list comprehensions, map is no longer worth
being supported so much.

>> I am not sure about unicode encode/decode.  I don't think it's very 
>> common to do a tasklet switch in the middle of a unicode encode or 
>> decode, though :)
> 
> 
> I thought Stackless was not only about tasklet switching, but also
> about running without stack... Wouldn't it perform the "hard" switching
> if the stack is running too deep?

Yes, it would, if you allow it to do so. This would happen
after a very deep recursion, which you wouldn't be able to
do with normal Python at all.

...

> It crashes in the process of throwing the exception - not because
> it finds no exception handler. It crashes because the internal
> data structures have been corrupted.

I don't know the C++ exception mechanism. It it walks the whole stack
once before taking an action, then this is a problem.
If it does proper unwinding of C frames, I could probably play the
game and restore things just in time.

Anyway, I don't really get the point.
95% of Stackless is doing soft-switched stackless calls.
Behavior is completely controllable. We can easily avoid
any special C stack operation, by setting a flag that
disallows it (easy to implement) or by excluding the hard
switching stuff, completely (not an option now, but easy, too).

The discussion, as often before, tries to find out why it is *not*
possible to include Stackless, instead of finding out the useful
parts which could be supported with relatively small impact.
This is why Stackless exists, and will continue to exist.

For me, this thread is closed -- thanks - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/




More information about the Python-Dev mailing list