Skip to content
Back to top
View this page

# ValueOptional

class dsviper.ValueOptional(type_optional, initial_value)

  Bases: `object`

  A class used to represent a value of type optional<element_type>.

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

  static cast(value: Value) → ValueOptional

    Return an optional or raise.

  clear() → None

    Clear the container.

  copy() → ValueOptional

    Return a deep copy.

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

    Return the description.

  get(default: _InputValues | None = None, *, encoded: bool = False) → _OutputValues

    Return the wrapped value or return default if given; otherwise raise.

  is_nil() → bool

    Return True if there is no value to unwrap.

  representation() → str

    Return the representation.

  type() → Type

    Return the type.

  type_code() → str

    Return the type code.

  type_optional() → TypeOptional

    Return the type optional<element_type>.

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

    Return the wrapped value or raise.

  wrap(value: _InputValues) → None

    Wrap the value.