Skip to content

Commit bc1f52c

Browse files
authored
Merge pull request keon#813 from Miladkhoshdel/patch-1
Increase performance of Function
2 parents 34871c5 + 02d451d commit bc1f52c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

algorithms/arrays/limit.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@
1414

1515
# tl:dr -- array slicing by value
1616
def limit(arr, min_lim=None, max_lim=None):
17-
min_check = lambda val: True if min_lim is None else (min_lim <= val)
18-
max_check = lambda val: True if max_lim is None else (val <= max_lim)
19-
20-
return [val for val in arr if min_check(val) and max_check(val)]
17+
return list(filter(lambda x: (min_lim <= x <= max_lim), arr))

0 commit comments

Comments
 (0)