Files
2026-06-04 04:36:39 -05:00

26 lines
532 B
Python

from __future__ import annotations
class Node:
def __init__(self, value: int, child: Node | None = None):
self.value = value
self.child = child
def flatten(node: Node | None) -> list[int]:
values: list[int] = []
while node is not None:
values.append(node.value)
node = node.child
return values
def run() -> None:
chain = Node(1, Node(2, Node(3)))
print('annotations:', flatten(chain))
print('future:', flatten.__annotations__)
if __name__ == '__main__':
run()