Verified Commit 82745b47 authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

improve hint typing

parent 0103f7d4
......@@ -13,7 +13,7 @@ class NDGraph:
below I implemented the 2nd version.
"""
def __init__(self, nodes):
def __init__(self, nodes: Sequence['Node']) -> None:
self.nodes: Set['Node'] = {n for n in nodes}
self.vertices: Dict['Node': Set['Node']] = {n: set() for n in self.nodes}
......@@ -80,10 +80,10 @@ class Node:
_id = itertools.count(0)
def __init__(self):
def __init__(self) -> None:
self.id: int = next(self._id)
def __hash__(self):
def __hash__(self) -> int:
# to be usable in set an object must be hashable
# so we need to implement __hash__
# which must returm an int uniq per object
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment