pg.Inferentiable¶
Accessible via pg.Inferentiable
, pg.symbolic.Inferential
.
- class Inferential[source]¶
Bases:
TopologyAware
,pg.CustomTyping
Interface for values that could be dynamically inferred upon read.
Inferential values are objects whose values are not determined directly but are instead derived from other sources, such as references (
pg.Ref
) to other objects or computed based on their context (pg.symbolic.ValueFromParentChain
) such as the symbolic tree they reside in.When inferential values are utilized as symbolic attributes, we can obtain their original definition by invoking
pg.Symbolic
, and their inferred values can be retrieved by callingpg.Symbolic
. The values retrieved frompg.Dict
,pg.List
andpg.Object
through __getitem__ or __getattribute__ are all inferred values.Methods:
infer
(**kwargs)Returns the inferred value.
- abstract infer(**kwargs)[source]¶
Returns the inferred value.
- Return type:
- Parameters:
**kwargs – Optional keyword arguments for inference, which are usually inferential subclass specific.
- Returns:
Inferred value.
- Raises:
AttributeError – If the value cannot be inferred.