|
Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|


Public Member Functions | |
| def | __call__ |
| def | __init__ |
A specialized BoundMethodWeakref, for platforms where instance methods are not descriptors. It assumes that the function name and the target attribute name are the same, instead of assuming that the function is a descriptor. This approach is equally fast, but not 100% reliable because functions can be stored on an attribute named differenty than the function's name such as in: class A: pass def foo(self): return "foo" A.bar = foo But this shouldn't be a common use case. So, on platforms where methods aren't descriptors (such as Jython) this implementation has the advantage of working in the most cases.
Definition at line 253 of file saferef.py.
| def saferef::BoundNonDescriptorMethodWeakref::__init__ | ( | self, | |
| target, | |||
onDelete = None |
|||
| ) |
Return a weak-reference-like instance for a bound method
target -- the instance-method target for the weak
reference, must have im_self and im_func attributes
and be reconstructable via:
target.im_func.__get__( target.im_self )
which is true of built-in instance methods.
onDelete -- optional callback which will be called
when this weak reference ceases to be valid
(i.e. either the object or the function is garbage
collected). Should take a single argument,
which will be passed a pointer to this object.
Reimplemented from saferef::BoundMethodWeakref.
Definition at line 270 of file saferef.py.
| def saferef::BoundNonDescriptorMethodWeakref::__call__ | ( | self | ) |
Return a strong reference to the bound method
If the target cannot be retrieved, then will
return None, otherwise returns a bound instance
method for our object and function.
Note:
You may call this method any number of times,
as it does not invalidate the reference.
Reimplemented from saferef::BoundMethodWeakref.
Definition at line 289 of file saferef.py.
1.7.4