[Pyrex] extending a builtin type

Robin Becker robin at reportlab.com
Tue Nov 20 17:58:11 CET 2007


I'm trying to get going with pyrex by converting a fairly complex algorithm in 
python to Pyrex. The algorithm is tex_wrap originally part of A Kuchling's 
oedipus project.

I've had fair success in improving the timing for the Python part both by 
choosing the right python structures and by moving bits from Python into pyrex. 
However the main object seems to elude me.

Originally I had a class in python called

class ObjectList(UserList):

but for speed reasons (and simplicity) I changed that to


class ObjectList(list):

I'm wondering how I can convert this to pyrex? Looking in the docs I see that we 
can do stuff with complexobject etc etc, but that's the struct. Is it possible 
for me to inherit from list? I have a few places where I use the listness of my 
class, but not many ie I use self[x] and obj.append(x) etc etc, but not so many 
I really need to worry about preserving them.
-- 
Robin Becker



More information about the Pyrex mailing list