C callbacks ? Re: Is Stackless Python DEAD?
Gordon McMillan
gmcm at hypernet.com
Tue Nov 6 14:02:11 EST 2001
More information about the Python-list mailing list
Tue Nov 6 14:02:11 EST 2001
- Previous message (by thread): C callbacks ? Re: Is Stackless Python DEAD?
- Next message (by thread): C callbacks ? Re: Is Stackless Python DEAD?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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). > I see maintaining hybrid behavior (iterative / recursive calls to the > interpreter, and 'recursion tolerance') as a requirement... True. And Stackless (as a 3rd party product) can get away with saying "Oops, I can't do that". The bar is higher for a core language feature, though. Which is a shame, because this turns out to be more of a theoretical problem than a real one. - Gordon
- Previous message (by thread): C callbacks ? Re: Is Stackless Python DEAD?
- Next message (by thread): C callbacks ? Re: Is Stackless Python DEAD?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list