C callbacks ? Re: Is Stackless Python DEAD?

Frederic Giacometti frederic.giacometti at arakne.com
Wed Nov 7 10:35:43 EST 2001


"Gordon McMillan" <gmcm at hypernet.com> wrote in message
news:Xns91518EE46939Bgmcmhypernetcom at 199.171.54.215...
> Frederic Giacometti wrote:
>
> >
> > "Gordon McMillan" <gmcm at hypernet.com> wrote in message
>
> [snip]
>
> >> But making Python *truly* stackless means getting rid of all
recursions,
> >> and that is an enormous task. If you don't do that, you've got a
> >> language feature that doesn't work in some apparently random set of
> >> circumstances.
> >
> > But how do you process callbacks to Python from C code (extensions or
> > embeded python)?
> >
> > One has to return to C after executing the Python code, and than C has
to
> > return to Python after executing the remainer of its code...
>
> All depends on what you mean by "return" <wink>. Try thinking of
"callbacks"
> and the "return" from callbacks as events.
>
> In Stackless, the Python stack and the C stack are completely separate.
> In the case where C code needs to call Python and then do something with
> the result (that is, where tail recursion doesn't apply), Christian used
> the trick of manufacturing a Python-style frame object that represents the
C
> code. As far as (Stackless) Python is concerned, it gets dispatched like
> any other frame (Stackless' Python "stack" is really a tree).

That's a very interesting paradigm :))
Thanks,

FG





More information about the Python-list mailing list