efficient Python object count

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


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.


More information about the Python-list mailing list