fsl.utils.weakfuncref
¶
This module provides the WeakFunctionRef
class.
-
class
fsl.utils.weakfuncref.
WeakFunctionRef
(func)[source]¶ Bases:
object
Class which encapsulates a
weakref
to a function or method.This class is used by
Notifier
instances to reference listeners which have been registered to be notified of property value or attribute changes.-
__init__
(func)[source]¶ Create a new
WeakFunctionRef
to encapsulate the given function or bound/unbound method.
-
_WeakFunctionRef__findPrivateMethod
()¶ Finds and returns the bound method associated with the encapsulated function.
-
_WeakFunctionRef__isMethod
(func)¶ Returns
True
if the given function is a bound method,False
otherwise.This seems to be one of the few areas where python 2 and 3 are irreconcilably incompatible (or just where
six
does not have a function to help us).In Python 3 there is no difference between an unbound method and a function. But in Python 2, an unbound method is still a method (and inspect.ismethod returns True).
-
__dict__
= mappingproxy({'__module__': 'fsl.utils.weakfuncref', '__doc__': 'Class which encapsulates a :mod:`weakref` to a function or method.\n\n This class is used by :class:`.Notifier` instances to reference\n listeners which have been registered to be notified of property value\n or attribute changes.\n ', '__init__': <function WeakFunctionRef.__init__>, '__str__': <function WeakFunctionRef.__str__>, '__repr__': <function WeakFunctionRef.__repr__>, '_WeakFunctionRef__isMethod': <function WeakFunctionRef.__isMethod>, '_WeakFunctionRef__findPrivateMethod': <function WeakFunctionRef.__findPrivateMethod>, '__call__': <function WeakFunctionRef.__call__>, 'function': <function WeakFunctionRef.function>, '__dict__': <attribute '__dict__' of 'WeakFunctionRef' objects>, '__weakref__': <attribute '__weakref__' of 'WeakFunctionRef' objects>})¶
-
__module__
= 'fsl.utils.weakfuncref'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-