Permalink
Browse files

switched to weak refs

  • Loading branch information...
1 parent e2b64a2 commit fdebd5421aebbc21473c4533a0309dce2f831656 @narfdotpl committed Nov 12, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 hottie.py
View
@@ -8,11 +8,12 @@
from os.path import exists, getmtime
import sys
from time import sleep
+from weakref import WeakSet
functions = {}
classes = {}
-instances = defaultdict(list)
+instances = defaultdict(WeakSet)
module_mtimes = {}
@@ -29,7 +30,7 @@ def class_decorator(cls, key):
@wraps(old_init)
def new_init(self, *args, **kwargs):
old_init(self, *args, **kwargs)
- instances[key].append(self)
+ instances[key].add(self)
cls.__init__ = new_init

0 comments on commit fdebd54

Please sign in to comment.