Alexandre Vassalotti wrote:
And that is exactly the reason why, the _pickle module doesn't use
__new__ for initialization.  Doing any kind of argument parsing in
__new__ prevents subclasses from customizing the arguments for their
__init__.

Although, I agree that __new__ should be used, whenever it is
possible, to initialize struct members.

You are missunderstanding me. I want everybody to set the struct members to *A* sensible default value, not *THE* value. Argument parsing can still happen in tp_init. tp_new should (or must?) set all struct members to sensible defaults like NULL for pointers, -1 or 0 for numbers etc.

Python uses malloc to allocate memory. Unless you are using debug builds the memory block is not initialized. In both cases the block of memory isn't zeroed. You all know the problems caused by uninitialized memory.

Christian
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to