This code snippet will allow you to look for objects of a certain type in memory. This is very useful for plugins:
""" This looks through all the objects in memory, to find ones of the designated type. """ import gc class Animal(object): def make_noise(self): print "snort" animal = Animal() for obj in gc.get_objects(): if type(obj) == Animal: obj.make_noise()
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment