Skip to content

Instantly share code, notes, and snippets.

@lxneng
Created July 20, 2012 04:28
Show Gist options
  • Save lxneng/3148701 to your computer and use it in GitHub Desktop.
Save lxneng/3148701 to your computer and use it in GitHub Desktop.
gc.get_objects()

gc.get_objects() is also pretty fun, every object in the system. For example:

def all_instances(cls):
    return [o for o in gc.get_objects() if isinstance(o, cls)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment