I have this python code:
for i, num in enumerate(num_arr):
if num > threshold:
num_arr[i] = threshold
'num_arr' is a simple array filled with integers, 'threshold' may vary from 10 to 100,000. Is there any faster way to achieve the same result? bitwise operation or something of that sort?