PySizeof: almost useful

Alex Martelli aleaxit at yahoo.com
Sat Feb 11 13:18:14 EST 2006


Ian Leitch <port001 at gentoo.org> wrote:
   ...
> 2. I'm at a loss as how to calculate the size of a long object -- any tips?

#include "longintrepr.h" (from the Python sources).  Then, given a
PyLongObject *l, abs(l->ob_size) is the number of "digits", each taking
SHIFT bits.

> Many thanks to anyone bored enough to review this code.

Sorry, I don't have the time, but I hope the above tip can be useful.


Alex



More information about the Python-list mailing list