From 79d4a4bc5f9fc131f006b8f67cf074ee6abfa6ee Mon Sep 17 00:00:00 2001 From: Akibuzzaman Akib Date: Tue, 14 Apr 2026 12:58:44 +0000 Subject: [PATCH] searches: improve type hints in linear_search.py - Narrowed list[int] generic type annotation on both linear_search() and rec_linear_search() for better type safety --- searches/linear_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searches/linear_search.py b/searches/linear_search.py index 8adb4a7015f0..98de2534ee96 100644 --- a/searches/linear_search.py +++ b/searches/linear_search.py @@ -9,7 +9,7 @@ """ -def linear_search(sequence: list, target: int) -> int: +def linear_search(sequence: list[int], target: int) -> int: """A pure Python implementation of a linear search algorithm :param sequence: a collection with comparable items (sorting is not required for @@ -33,7 +33,7 @@ def linear_search(sequence: list, target: int) -> int: return -1 -def rec_linear_search(sequence: list, low: int, high: int, target: int) -> int: +def rec_linear_search(sequence: list[int], low: int, high: int, target: int) -> int: """ A pure Python implementation of a recursive linear search algorithm