httk.core.vectors.vector_native_backend

Backend wrapping plain nested sequences (lists/tuples of numeric or string leaves).

Classes

VectorNativeBackend

Backend for a vector backed by plain nested sequences.

Module Contents

class httk.core.vectors.vector_native_backend.VectorNativeBackend(obj, **hints)[source]

Bases: httk.core.vectors.vector_backend.VectorBackend

Backend for a vector backed by plain nested sequences.

The native representation is a (possibly nested) rectangular list or tuple whose leaves are int, float, decimal.Decimal, fractions.Fraction, or str. Conversion into the exact fractions interchange goes through FracVector, so string-uncertainty parsing (e.g. "0.33342(10)") works here too. unwrap returns the original raw object.

Parameters:
  • obj (Any) – The rectangular source data to wrap.

  • **hints (Any) – Optional backend-selection hints.

property native: Any[source]

The original nested list/tuple this backend wraps, leaves untouched.

This is the same object returned by unwrap(), exposed as a named accessor so the native view can present a natively-held vector’s leaves verbatim (its preserve-original default) without reaching into private state.

property fractions: httk.core.vectors.vector_api.Fractions[source]

Return the native value in the exact Fraction interchange format.

property dim: tuple[int, ...][source]

Return the native value’s shape.

unwrap()[source]

Return the original nested list or tuple.