[Python-Dev] Proper initialization of structs

Fred Drake fdrake at acm.org
Thu Oct 30 18:00:35 CET 2008


On Oct 30, 2008, at 10:20 AM, Christian Heimes wrote:
> I like to establish a rule that *all* struct members must be  
> initialized properly in the type's tp_new function.


I think this has always been a requirement.  The result of the "new"  
operation must conform to all the requirements that the type's C code  
demands.

It's good to move work into __init__ where reasonable, so that it can  
be avoided if a subclass wants it done in a completely different way,  
but new can't work that way.


   -Fred

-- 
Fred Drake   <fdrake at acm.org>



More information about the Python-Dev mailing list