Gregory Ewing a écrit :
(snip)

import weakref

class weakmethod(object):

  def __init__(self, bm):
    self.ref = weakref.ref(bm.im_self)
    self.func = bm.im_func

  def __call__(self, *args, **kwds):
    obj = self.ref()
    if obj is None:
      raise ValueError("Calling dead weak method")
    self.func(obj, *args, **kwds)

Would be better with :

      return self.func(obj, *args, *kwds)

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to