designspace.FloatLiteral#

class designspace.FloatLiteral(lo: float, hi: float)#

Bases: object

A range of real constants admissible in a .symbolic() tree.

Declare one among a symbolic parameter’s primitives to allow {“const”: v} nodes; a constant is valid only if it falls within some declared literal’s bounds.

lo#

Lowest admissible constant.

Type:

float

hi#

Highest admissible constant.

Type:

float

Examples

>>> lit = ds.FloatLiteral(-1.0, 1.0)
>>> lit.lo, lit.hi
(-1.0, 1.0)
property chart: Chart#

A chart over the literal’s range, for a consumer that generates trees.

Offered for convenience only: the library ships no evaluator and never draws constants itself.

Examples

>>> ds.FloatLiteral(-1.0, 1.0).chart.from_unit(0.5)
0.0