Skip to content
Back to top
View this page

# ValueVariant

class dsviper.ValueVariant

  Bases: `object`

  ValueVariant(type_variant, initial_value). A class used to represent a value of type variant<T0, …>. Seamless with a Python object compatible with the variant’s types.

  Or use Value.create(type_variant [, initial_value]).

  static cast(value: Value) → ValueVariant

    Return a variant<T0, …> or raise.

  copy() → ValueVariant

    Return a deep copy.

  description(*, namespace: NameSpace | None = None) → str

    Return the description.

  hash() → int

    Return the hash value.

  representation() → str

    Return the representation.

  type() → Type

    Return the type.

  type_code() → str

    Return the type code.

  type_variant() → TypeVariant

    Return the type variant<T0, …>.

  unwrap(*, encoded: bool = True) → _OutputValues

    Return the value or raise.

  wrap(value: _InputValues, type: Type | None = None) → None

    wrap a value.