Skip to content

Commit 02d451d

Browse files
Increase performance of Function
3 Times Faster Response
1 parent 34871c5 commit 02d451d

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy