En Sun, 18 Jan 2009 22:18:59 -0200, Floris Bruynooghe
<floris.bruynoo...@gmail.com> escribió:
I've been trying to figure out how to override methods of a class in
the C API. For Python code you can just redefine the method in your
subclass, but setting tp_methods on the type object does not seem to
have any influcence. Anyone know of a trick I am missing?
No tricks; you have to define the new type structure, probably including
tp_methods if you redefine any... (Ensure you create an object of the new
type, obviously)
See e.g. _collections.c how defaultdict inherits from dict.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list