pystencils.types.PsNumericType

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 on create_constant to instantiate constants of a given numeric type. The object returned by create_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:

Any

Parameters:

value (Any)