colour.utilities.multiline_repr#
- colour.utilities.multiline_repr(object_: Any, attributes: List[dict], reduce_array_representation: bool = True) str [source]#
Return an (almost) evaluable string representation of the given object.
- Parameters:
- Returns:
(Almost) evaluable string representation.
- Return type:
class`str`
Examples
>>> class Data: ... def __init__(self, a: str, b: int, c: list): ... self._a = a ... self._b = b ... self._c = c ... ... def __repr__(self) -> str: ... return multiline_repr( ... self, ... [ ... {"name": "_a"}, ... {"name": "_b"}, ... { ... "name": "_c", ... "formatter": lambda x: repr(x) ... .replace("[", "(") ... .replace("]", ")"), ... }, ... ], ... ) >>> Data("Foo", 1, ["John", "Doe"]) Data('Foo', 1, ('John', 'Doe'))