designspace.param_from_def#
- designspace.param_from_def(pd: ParamDef) TypedParamExpr#
Turn a resolved parameter back into a builder.
The inverse of declaring one, and half of what makes the IR bidirectional: read a space, adjust a parameter, rebuild. Useful when generating spaces from a registry or a catalogue rather than writing them out by hand.
- Parameters:
pd (ParamDef) – A resolved parameter, typically from Space.params.
- Returns:
A builder equivalent to the original declaration.
- Return type:
- Raises:
TypeError – If the parameter is a struct or choice, or a .repeat() of one. Such a parameter’s contents live in other ParamDef entries and cannot be recovered from this one alone; pass the whole IR to ds.space_from_ir() instead.
Examples
>>> s = ds.space(ds.param("depth").integer(1, 8)) >>> rebuilt = ds.space(ds.param_from_def(s.params["depth"])) >>> rebuilt.fingerprint() == s.fingerprint() True