[Stackless] flextype and virtual functions

Christian Tismer tismer at stackless.com
Thu Feb 13 13:08:41 CET 2014

Flextype was an early implementation of fast method-calling in types
like channel, tasklet, and even stacklessmodule ... ;-)

This was written around 2002, even before new-style classes and type 
existed, and it has then never been used by anybody or understood, I 
because I never got any question about this in ages.

Today, this is redundant and we removed it right now.

This is a good step for reducing the size of the stackless code and using
more current techniques.

Thanks for resolving that -- Chris

On 12/02/14 21:42, Kristján Valur Jónsson wrote:
> Hello all.
> I am currently working on removing a piece of internal code called 
> "Flextype" and reorganizing the stackless library. This will involve 
> splitting it into a builting module, _stackless, and a .py module, 
> stackless.py.
> One of the things I want to do  is to remove functionality that I 
> think is probably not relied upon, in the C api:
> certain C api functions that are methods on channes and tasklets, will 
> currently work in a virtual way.  This is best explained by an example:
> if PyChannel_Send(c, d) is called with an instance of PyChannelType, 
> then an internal C function is invoked as expected.
> However, if c is an instance of an inherited type, one that overrides 
> "send", then PyChannel_Send(c, d) will actually behave as if 
> "c.send()" had been called from python code.  It will invoke the 
> overriddedn "send" function.
> Originally, the idea was that frameworks would perhaps replace the 
> standard classes with subclasses, and still want to pass these through 
> to C code that would work exactly as python code.
> However, this is an unlikely scenario, IMHO.  Also, this sort of 
> behaviour is very unusual in a pythonesque API: PyList_Append(l, a) is 
> _not_ the same as calling "l.append(a)", because a subclass' "append" 
> method won't be invoked.
> Are there any objections to me removing this fringe functionality?
> In other news, I'll be removing the modules' __tasklet__ and 
> __channel__ attributes.  These are documented to represent the actuall 
> classes created when channels and tasklets are created using the C api 
> and the python functions.  However, this is incorrect.  These 
> attributes are settable and gettable, but otherwise not used 
> anywhere!  Which shows how useful they are.
> Cheers,
> Kristján
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless

Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20140213/74d211d6/attachment.html>

More information about the Stackless mailing list