[Python-Dev] PEP 42: sizeof(obj) builtin

Thomas Heller theller@python.net
31 Jan 2003 11:26:15 +0100


"Raymond Hettinger" <raymond.hettinger@verizon.net> writes:

> I'm about to start working on this one and wanted
> to check here first to make sure there is still a 
> demand for it and to get ideas on the best implementation
> strategy.
> 

Unfortunately sizeof() is implemented in ctypes with different
sematics, there it has the same meaning as sizeof() in C, and only
works on ctypes' data types: sizeof(c_int) == 4 on 32-bit machines.

But I'm afraid a Python builtin sizeof() would win, so do
I have to choose a different name?

> I'm thinking of summing all of the tp_basicsize slots
> while recursing through tp_traverse.
> 
> 
> Raymond Hettinger

Thomas