Skip to content

Commit 5f2348a

Browse files
authored
Refactor empty list check in tim_sort
1 parent 0e9f695 commit 5f2348a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎sorts/tim_sort.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def tim_sort(lst: list[Any] | tuple[Any, ...] | str) -> list[Any]:
5555
>>> tim_sort([])
5656
[]
5757
"""
58-
length = len(lst)
59-
if length == 0:
58+
if not lst:
6059
return []
60+
length = len(lst)
6161
runs, sorted_runs = [], []
6262
new_run = [lst[0]]
6363
sorted_array: list[Any] = []

0 commit comments

Comments
 (0)