A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-October/083213.html below:

[Python-Dev] Proper initialization of structs

[Python-Dev] Proper initialization of structs [Python-Dev] Proper initialization of structsChristian Heimes lists at cheimes.de
Fri Oct 31 00:43:46 CET 2008
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
More information about the Python-Dev mailing list

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