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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4