diff --git a/src/core/list.py b/src/core/list.py index c740861..3e74748 100644 --- a/src/core/list.py +++ b/src/core/list.py @@ -14,6 +14,7 @@ if TYPE_CHECKING: class PebbleList(metaclass=BuiltinType): def __init__(self, items: Optional[list[Any]] = None): self.items: list[Any] = items or [] + self._stringify_visited: bool = False def get(self, index: Any, bracket: Token): idx: int = Cast.as_int(bracket, index) @@ -24,7 +25,12 @@ class PebbleList(metaclass=BuiltinType): self.items[idx] = value def __str__(self): - return "[" + ", ".join(map(lambda item: StringFormatter.stringify(item, True), self.items)) + "]" + if self._stringify_visited: + return "[...]" + self._stringify_visited = True + res: str = "[" + ", ".join(map(lambda item: StringFormatter.stringify(item, True), self.items)) + "]" + self._stringify_visited = False + return res # Exposed methods @exposed(nargs=1)