Skip to content

Commit aef85ec

Browse files
dimanudimanu-py
authored andcommitted
feat(look-up): implement __iter__ method
This method is required by the Iterable abstract class
1 parent 794d4bc commit aef85ec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

look_up.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Protocol, Mapping, overload, Iterable, Sequence
1+
from typing import Any, Protocol, Mapping, overload, Iterable, Sequence, Iterator
22

33

44
class Comparable(Protocol):
@@ -55,3 +55,6 @@ def __init__(self, source: Iterable[tuple[Comparable, Any]] | BaseMapping | None
5555

5656
def __len__(self) -> int:
5757
return len(self.keys)
58+
59+
def __iter__(self) -> Iterator[Comparable]:
60+
return iter(self.keys)

0 commit comments

Comments
 (0)