reprstream
Streaming repr, yielding tokens.
def reprstream(
stack: deque,
seen: Optional[Set],
maxlevels: int,
level: int,
isinstance: Callable
) - > Iterator[Any]
Streaming repr, yielding tokens.
Parameters
| Name | Type | Description |
|---|---|---|
| stack | deque | A double-ended queue containing iterables to be processed, used to manage the traversal of nested data structures. |
| seen | Optional[Set] | A set of object memory addresses used to track visited objects and prevent infinite recursion in circular references. |
| maxlevels | int | The maximum depth of nested objects to traverse before truncating the output with an ellipsis. |
| level | int | The current nesting depth level during the recursive traversal. |
| isinstance | Callable | The function used for type checking, typically the built-in isinstance. |
Returns
| Type | Description |
|---|---|
Iterator[Any] | An iterator yielding pairs of tokens (strings or literal markers) and the current iterable being processed. |