]> granicus.if.org Git - python/commitdiff
bug [ 1228904 ] weakref example broken
authorGeorg Brandl <georg@python.org>
Sat, 2 Jul 2005 10:44:32 +0000 (10:44 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 2 Jul 2005 10:44:32 +0000 (10:44 +0000)
Doc/lib/libweakref.tex

index c76684bf027bb13640ea157c055a2119bef5c449..617540b048e77373efd6b1a06e2fd80b59043c7a 100644 (file)
@@ -255,13 +255,10 @@ returned when the referent is accessed:
 import weakref
 
 class ExtendedRef(weakref.ref):
-    def __new__(cls, ob, callback=None, **annotations):
-        weakref.ref.__new__(cls, ob, callback)
-        self.__counter = 0
-
     def __init__(self, ob, callback=None, **annotations):
         super(ExtendedRef, self).__init__(ob, callback)
-        for k, v in annotations:
+        self.__counter = 0
+        for k, v in annotations.iteritems():
             setattr(self, k, v)
 
     def __call__(self):