Skip to content

Commit 5afff59

Browse files
committed
Clearer range check
1 parent d9adeb4 commit 5afff59

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

more_itertools/recipes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ def nth_combination(iterable, r, index):
655655

656656
if index < 0:
657657
index += c
658-
659-
if (index < 0) or (index >= c):
658+
if not 0 <= index < c:
660659
raise IndexError
661660

662661
result = []

0 commit comments

Comments
 (0)