scalar#

swordfish.scalar(data, *, type=None)#

Creates a Swordfish Scalar from a Python object.

Parameters:
  • data (Any) – The input data to be converted into a Scalar.

  • type (DataType, optional) – The desired data type for the Scalar. Defaults to None.

Returns:

A Swordfish Scalar object representing the input data.

Return type:

Scalar

Examples

>>> import swordfish as sf
>>> x = sf.scalar(3)
>>> x
Long(3)
>>> y = sf.scalar(3, type="INT")
>>> y
Int(3)