bug [ 1228904 ] weakref example broken

This commit is contained in:
Georg Brandl 2005-07-02 10:44:32 +00:00
parent 1c330eb9eb
commit 376e6227b4
1 changed files with 2 additions and 5 deletions

View 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):