httk.core.vectors.vector_native_view¶
A view presenting any vector backend as nested tuples, with a selectable leaf codec.
Classes¶
A view presenting an underlying vector backend as nested tuples, with a selectable leaf codec. |
Module Contents¶
- class httk.core.vectors.vector_native_view.VectorNativeView(obj, **hints)¶
Bases:
httk.core.vectors.vector_view.VectorView,tupleA view presenting an underlying vector backend as nested tuples, with a selectable leaf codec.
The leaf codec is the element-domain axis (see
httk.core.vectors.leaf_codecs); it is chosen with theleaf=hint plus any codec options (rounding=,digits=, …). There are three modes:preserve-original (
leaf=None, and the source is natively-held data): the backend’s original nested leaves are presented verbatim — the same objects, only containers tuple-ized (Decimal\ s in, the sameDecimal\ s out).exact default (
leaf=None, source crossing from a frac/numpy backend): the"exact"codec —intwhen integral, elsefractions.Fraction, never a float.explicit codec (
leaf="int"/"float"/"decimal"/"fraction"/…): every element is converted from the backend’s exactfractionsinterchange through that codec.
The codec name and its options are validated eagerly at construction (an unknown codec name or invalid option raises
ValueError); a codec never raises on the data — a value it cannot represent exactly takes the codec’s documented default conversion, because the backend keeps the exact original. A scalar source is presented as a single-element tuple.- Parameters:
obj (httk.core.vectors.vector_like.VectorLike) – The source value to present.
**hints (Any) – Backend-selection, leaf-codec, and codec-option hints.
- unwrap()¶
Return the underlying unwrapped vector.
- unview()¶
Return a plain tuple containing the presented leaves.