Note
This documentation is for a development version. Click here for the latest stable release (v1.3.0).
nengo_spa.types¶
Types used in the NengoSPA type system to verify operations.
Classes
|
Describes a type. |
|
Type that allows for any vocab of a given dimensionality. |
|
Type for a specific vocabulary. |
Functions
|
Returns the most specific type in the argument list. |
-
class
nengo_spa.types.
Type
(name)[source]¶ Bases:
object
Describes a type.
Types can be compared and by default two types are considered to be equal when their class and name match. Subclasses are allowed to overwrite __eq__.
Furthermore, a partial ordering can be defined over types by overwriting the __gt__ method. A call to
a.__gt__(b)
should return True, if (and only if) b can be cast to the type a. For example, the type for an unspecified vocabulary can be cast to the type for a specific vocabulary.Note, that other comparison operators will be implemented on the implementation of __gt__.
- Parameters
- namestr
Name of the type.
-
class
nengo_spa.types.
TAnyVocabOfDim
(dimensions)[source]¶ Bases:
nengo_spa.types.Type
Type that allows for any vocab of a given dimensionality.
-
class
nengo_spa.types.
TVocabulary
(vocab)[source]¶ Bases:
nengo_spa.types.Type
Type for a specific vocabulary.
All vocabulary types constitute a type class.
-
nengo_spa.types.
coerce_types
(*types)[source]¶ Returns the most specific type in the argument list.
If the types passed in the argument list are incompatible a
SpaTypeError
will be raised.The specificity of a types is defined by their partial ordering implemented in the type classes.