Package mdp :: Class ExtensionNode
[hide private]
[frames] | no frames]

Class ExtensionNode


Base class for extensions nodes.

A new extension node class should override the _extension_name.
The concrete node implementations are then derived from this extension
node class.

To call an instance method from a parent class you have multiple options:

- use super, but with the normal node class, e.g.:

  >>>  super(mdp.nodes.SFA2Node, self).method()      # doctest: +SKIP

  Here SFA2Node was given instead of the extension node class for the
  SFA2Node.

  If the extensions node class is used directly (without the extension
  mechanism) this can cause problems. In that case you have to be
  careful about the inheritance order and the effect on the MRO.

- call it explicitly using the __func__ attribute [python version < 3]:

  >>> parent_class.method.__func__(self)             # doctest: +SKIP

  or [python version >=3]:

  >>> parent_class.method(self)                      # doctest: +SKIP

To call the original (pre-extension) method in the same class use you
simply prefix the method name with '_non_extension_' (this is the value
of the `ORIGINAL_ATTR_PREFIX` constant in this module).

Instance Methods [hide private]

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  extension_name = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Class Variable Details [hide private]

extension_name

hash(x)

Value:
None