本文整理匯總了Python中blinker._saferef.BoundMethodWeakref方法的典型用法代碼示例。如果您正苦於以下問題:Python _saferef.BoundMethodWeakref方法的具體用法?Python _saferef.BoundMethodWeakref怎麽用?Python _saferef.BoundMethodWeakref使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類blinker._saferef
的用法示例。
在下文中一共展示了_saferef.BoundMethodWeakref方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: callable_reference
# 需要導入模塊: from blinker import _saferef [as 別名]
# 或者: from blinker._saferef import BoundMethodWeakref [as 別名]
def callable_reference(object, callback=None):
"""Return an annotated weak ref, supporting bound instance methods."""
if hasattr(object, 'im_self') and object.im_self is not None:
return BoundMethodWeakref(target=object, on_delete=callback)
elif hasattr(object, '__self__') and object.__self__ is not None:
return BoundMethodWeakref(target=object, on_delete=callback)
return annotatable_weakref(object, callback)