Commits

Jed Brown committed 80db3a8

config: python-2.4 does not support __missing__()

This alternative form of memoize always returns successfully from the
lookup, avoiding the need for __missing__ to be invoked.

  • Participants
  • Parent commits 96c122f

Comments (0)

Files changed (1)

File config/BuildSystem/config/util.py

         self.func = func
 
     def __call__(self, *args):
-        return self[args]
-
-    def __missing__(self, args):
-        ret = self[args] = self.func(*args)
-        return ret
+        try:
+            return self[args]
+        except KeyError:
+            ret = self[args] = self.func(*args)
+            return ret