BaseDimension

Labs

class BaseDimension

Description

A simple wrapper for a short-named base dimension.

We assume that dimension symbols are short, i.e. under 7 characters long or a single character (preferred), anything past that will be truncated.

Inheritance:

Members defined in BaseDimension (7 members)

discriminant

R

System of quantities discriminant.

order

R

Order for sorting this dimension among the same system of quantities as determined by discriminant.

symbol

R

The symbol of this dimension.

__hash__

__init__

Construct a new BaseDimension with a given short symbol.

__repr__

__str__

Attributes

property discriminant: int

System of quantities discriminant.

This allows using the same symbol between different systems of quantities, and resolve them uniquely.

This is pointer sized so that dimensions can be easily attached to AST nodes, e.g. by using their ids as discriminants.

property order: int

Order for sorting this dimension among the same system of quantities as determined by discriminant.

property symbol: str

The symbol of this dimension.

Methods

__hash__() → int
__init__(symbol: str, order: int = 0, discriminant: int = 0) → None

Construct a new BaseDimension with a given short symbol.

Note that long symbols will be truncated to 7 characters! discriminants less than or equal to 7 are reserved, with 0 used by ISQ dimensions.

__repr__() → str
__str__() → str