Kind

Labs

class Kind

Description

A kind of specification.

Kinds are implicitly assignable to any specific quantities of that kind. This is effectively a new type over Specification for better interface typing.

Inheritance:

Members defined in Kind (11 members)

dimensions

R

Exact exponents of each nonzero dimension.

expression

R

The expression use to derive this quantity specification.

is_base

R

Whether this specification is the root of its hierarchy, i.e. a named specification without a parent.

name

R

Name given to this quantity specification, e.g. length, width.

owned_expression

R

The expression owned by this specification.

parent

R

The immediate parent specification if this is a child specification.

spec

R

The specification this kind was constructed from.

__hash__

__str__

common_with

Try and find a specification common to both left and right.

convertible_from

Whether other can be assigned to a quantity specified by this.

Attributes

property dimensions: syside.BufferView[tuple[syside.experimental.units.BaseDimension, fractions.Fraction]]

Exact exponents of each nonzero dimension.

property expression: syside.BufferView[tuple[syside.experimental.units.Specification, fractions.Fraction]]

The expression use to derive this quantity specification.

property is_base: bool

Whether this specification is the root of its hierarchy, i.e. a named specification without a parent.

property name: str | None

Name given to this quantity specification, e.g. length, width.

None if this was derived from an expression.

property owned_expression: syside.BufferView[tuple[syside.experimental.units.Specification, fractions.Fraction]]

The expression owned by this specification.

May be empty if one is inherited, and not overridden.

property parent: syside.experimental.units.Specification | None

The immediate parent specification if this is a child specification.

property spec: syside.experimental.units.Specification

The specification this kind was constructed from.

Methods

__hash__() → int
__str__() → str
common_with(arg: syside.experimental.units.Specification, /) → syside.experimental.units.Specification | None

Try and find a specification common to both left and right.

If kinds are different, none is returned.

common_with(arg: syside.experimental.units.Kind, /) → syside.experimental.units.Kind | None

Try to find a specification common with other.

If kinds are different, none is returned, otherwise this, i.e. common type is promoted from kind, rather than demoted to a common kind.

convertible_from(arg: syside.experimental.units.Specification, /) → syside.experimental.units.Convertible
convertible_from(arg: syside.experimental.units.Kind, /) → syside.experimental.units.Convertible

Whether other can be assigned to a quantity specified by this.