efficient Python object count

darrenr darren.ranalli at gmail.com
Fri Nov 7 03:15:35 CET 2008


Hello,

Does anyone know of an efficient way to get a count of the total
number of Python objects in CPython? The best solution I've been able
to find is len(gc.get_objects()) which unfortunately has to walk a C
linked list *and* creates a list containing all of the objects, when
all I need is an object count.

Thanks!



More information about the Python-list mailing list