[Pyrex] special methods

Bryan Weingarten bryan.weingarten at pobox.com
Wed Nov 12 04:03:34 CET 2003


i've read the docs on special methods in the extensions type section, 
but i'm having trouble with this one.  the doc says that __del__ will 
get called before __dealloc__.  but i can't get it to be called    on 
the same page in the table below, i noticed that __del__ is not 
included, so i wonder if __del__ is really a special method for types.  
i know that __del__ gets called when class Foo is not a type.

 >>> p = foo.Foo()
__new__
__init__
 >>> del p
__dealloc__

cdef class Foo
    def __new__(self):   
        print '__new__'

    def __init__(self):
        print '__init__'        

    def __del__(self):
        print '__dealloc__'
                                        
    def __dealloc__(self):
        print '__dealloc__'


thanks,

bryan





More information about the Pyrex mailing list