MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __post_init__

Method __post_init__

graphs/deep_clone_graph.py:21–26  ·  view source on GitHub ↗

>>> Node(3).neighbors []

(self)

Source from the content-addressed store, hash-verified

19 neighbors: list["Node"] | None = None
20
21 def __post_init__(self) -> None:
22 """
23 >>> Node(3).neighbors
24 []
25 """
26 self.neighbors = self.neighbors or []
27
28 def __hash__(self) -> int:
29 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected