Help: sizeof() and reference in python?
Fredrik Lundh
effbot at telia.com
Sun Mar 5 15:51:23 EST 2000
Gene Chiaramonte <gchiaramonte at ibl.bm> wrote:
> I guess I should have been more specific.
unfortunately, that doesn't help in this case ;-)
> 1 - I am trying to get the size of an object in bytes to monitor how much
> memory a list or object occupies.
you can't.
(well, you can always do it yourself, using a dictionary
to map type(object) to approximate size of object. see
the struct definitions in Include/*.h for more info on how
the basic types are implemented).
> 2 - I am trying to get the pointer to the memory address of an object.
Much
> like the array objects buffer_info(), where the second item in the
returned
> tuple is the pointer to the memory address of the first element of the
> array.
since you cannot do anything with it anyway, why not
just use id(object). it's a pretty good approximation...
</F>
<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list