colour.utilities.LazyCanonicalMapping#
- class colour.utilities.LazyCanonicalMapping(data: Generator | Mapping | None = None, **kwargs: Any)[source]#
Bases:
CanonicalMapping
Implement a lazy delimiter and case-insensitive
dict
-like object inheriting fromcolour.utilities.CanonicalMapping
class.The lazy retrieval is performed as follows: If the value is a callable, then it is evaluated and its return value is stored in place of the current value.
- Parameters:
Methods
Examples
>>> def callable_a(): ... print(2) ... return 2 >>> methods = LazyCanonicalMapping({"McCamy": 1, "Hernandez": callable_a}) >>> methods["mccamy"] 1 >>> methods["hernandez"] 2 2