Skip to content

Commit 97b6607

Browse files
authored
fix(types): add Comparable bound to jump_search type parameter
Updated the PEP 695 type parameter syntax to include the 'Comparable' bound. This resolves the Mypy error regarding unsupported left operand types for the '<' operator, ensuring that the generic type T supports comparisons.
1 parent 64e413c commit 97b6607

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

searches/jump_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __lt__(self, other: Any, /) -> bool: ...
2020
T = TypeVar("T", bound=Comparable)
2121

2222

23-
def jump_search[T](arr: Sequence[T], item: T) -> int:
23+
def jump_search[T: Comparable](arr: Sequence[T], item: T) -> int:
2424
"""
2525
Python implementation of the jump search algorithm.
2626
Return the index if the `item` is found, otherwise return -1.

0 commit comments

Comments
 (0)