pystencils.types.PsNumericType#
- class pystencils.types.PsNumericType(const=False)#
Numeric data type, i.e. any type that may occur inside arithmetic-logical expressions.
Constants
Every numeric type has to act as a factory for compile-time constants of that type. The
PsConstant
class relies oncreate_constant
to instantiate constants of a given numeric type. The object returned bycreate_constant
must implement the necessary arithmetic operations, and its arithmetic behaviour must match the given type.create_constant
should fail whenever its input cannot safely be interpreted as the given type.- Parameters:
args (Any)
kwargs (Any)
- Return type:
Any
- abstract create_constant(value)#
Create the internal representation of a constant with this type.
- Raises:
PsTypeError – If the given value cannot be interpreted in this type.
- Return type:
- Parameters:
value (Any)