enigma2  2.6
Public Member Functions | List of all members
enigma.WeakMethodReference Class Reference
Inheritance diagram for enigma.WeakMethodReference:

Public Member Functions

def __init__ (self, function=None)
 
def __call__ (self, *args, **kwargs)
 
def is_dead (self)
 
def is_alive (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (self)
 

Detailed Description

Stores a reference to an object's method or a
function.

This class also provides comparison operators to
allow proper usage in containers such as set([]).

The ability to change the weak reference is not
supported to prevent mutability. This is important
for container support as the object hash would
change after storing it.

Constructor & Destructor Documentation

◆ __init__()

def enigma.WeakMethodReference.__init__ (   self,
  function = None 
)
Initialises the weak reference with
a function or class method.

Member Function Documentation

◆ __call__()

def enigma.WeakMethodReference.__call__ (   self,
args,
**  kwargs 
)
@return Calls a new bound-method like the original, or
the original function if refers just to a function or
unbound method and returns its result.
Returns None if the original object doesn't exist

◆ __eq__()

def enigma.WeakMethodReference.__eq__ (   self,
  other 
)
Enables comparison between different weak
pointer objects that point to the same
object based on the contents instead of the
object pointer.

◆ __hash__()

def enigma.WeakMethodReference.__hash__ (   self)
this method is provided to allow comparison of
references inside of containers like set([])

http://stackoverflow.com/questions/3942303/how-does-a-python-set-check-if-two-objects-are-equal-what-methods-does-an-o

◆ __ne__()

def enigma.WeakMethodReference.__ne__ (   self,
  other 
)
Enables comparison between different weak
pointer objects that point to the same
object based on the contents instead of the
object pointer.

◆ is_alive()

def enigma.WeakMethodReference.is_alive (   self)
The equivalent to 'not is_dead()'
Make a positive method call because
double negatives suck

◆ is_dead()

def enigma.WeakMethodReference.is_dead (   self)
Returns True if the referenced callable was a bound method and
the instance no longer exists. Otherwise, return False.

The documentation for this class was generated from the following file: