We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc36ca3 commit a6b5924Copy full SHA for a6b5924
1 file changed
libdestruct/common/array/array_impl.py
@@ -57,6 +57,10 @@ def to_bytes(self: array_impl) -> bytes:
57
"""Return the serialized representation of the array."""
58
return b"".join(bytes(x) for x in self)
59
60
+ def to_str(self: array_impl, indent: int = 0) -> str:
61
+ """Return the string representation of the array."""
62
+ return "[" + ", ".join(x.to_str(indent) for x in self) + "]"
63
+
64
def __setitem__(self: array_impl, index: int, value: obj) -> None:
65
"""Set an item in the array."""
66
raise NotImplementedError("Cannot set items in an array.")
0 commit comments