Prevent cyclical import when type hinting custom exception __init__ method
Discussions on Python.org
Prevent cyclical import when type hinting custom exception __init__ method
Hi, I’m trying to create a tree data structure in python to do this I have the following files: # module/node.py from collections.abc import Iterable from module.exceptions import MultipleParentsError class Node: def __init__(self, initial_children: Iterable[Node] = ()) -> None: self.parent: Node | None = None self.children: list[Node] = [] for child in initial_children: self.add_child(child) def add_child(self, child): if chil...
0 comments
No comments yet.