Re: Opaque structures and Extension Types
Greg Ewing <[email protected]> Thu, 15 May 2008 20:27:40 +1200
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
Roberto Cavada wrote: > Now if I need to use __init__ I wonder what those 'some > circumstances' are exactly, especially which are the cases when > __init__ is not called at all. It's not called when Python code calls the class's __new__ method directly instead of calling the class itself. Another situation is unpickling, although that's not likely to bother you, since extension types aren't pickleable anyway unless you take steps to enable it. > For deallocation, I've thought I can rely on __dealloc__ in root > classes and exploit virtual destructors in my C structures. Yes, you should always be able to rely on __dealloc__ getting called, and C method calls from it should work as expected. -- Greg