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

Barry A. Warsaw barry@python.org
Fri, 31 Jan 2003 08:58:44 -0500


>>>>> "MAL" == M  <mal@lemburg.com> writes:

    MAL> I'm sure this could easily be turned into a std lib module
    MAL> which then covers all the Python builtins....

But I think such a function would be more useful if extension types
can play along.  I mean, there's fairly good lore about the memory
footprint of built-in types, but it would be much harder to figure
that out for some 3rd party extension type you grabbed off the net.
So I think it would be much more useful in the latter case.

>>>>> "SP" == Samuele Pedroni <pedronis@bluewin.ch> writes:

    SP> it is very unlikely that we can implement this in Jython,

    SP> I would prefer it to be

    | sys.sizeof
    | or sys._sizeof

This is an important point, so I'd prefer sys._sizeof().

-Barry