Skip to content

Commit

Permalink
use range(len()) instead of enumerate
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishi Kulkarni committed Jan 20, 2022
1 parent e1dc133 commit 540c910
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions numba/np/arrayobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -3790,7 +3790,7 @@ def numpy_full_nd(context, builder, sig, args):
def full(shape, value):
arr = np.empty(shape, type(value))
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = value
return arr

Expand All @@ -3805,7 +3805,7 @@ def numpy_full_dtype_nd(context, builder, sig, args):
def full(shape, value, dtype):
arr = np.empty(shape, dtype)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = value
return arr

Expand All @@ -3819,7 +3819,7 @@ def numpy_full_like_nd(context, builder, sig, args):
def full_like(arr, value):
arr = np.empty_like(arr)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = value
return arr

Expand All @@ -3834,7 +3834,7 @@ def numpy_full_like_nd_type_spec(context, builder, sig, args):
def full_like(arr, value, dtype):
arr = np.empty_like(arr, dtype)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = value
return arr

Expand All @@ -3848,7 +3848,7 @@ def numpy_ones_nd(context, builder, sig, args):
def ones(shape):
arr = np.empty(shape)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = 1
return arr

Expand All @@ -3865,7 +3865,7 @@ def numpy_ones_dtype_nd(context, builder, sig, args):
def ones(shape, dtype):
arr = np.empty(shape, dtype)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = 1
return arr

Expand All @@ -3879,7 +3879,7 @@ def numpy_ones_like_nd(context, builder, sig, args):
def ones_like(arr):
arr = np.empty_like(arr)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = 1
return arr

Expand All @@ -3894,7 +3894,7 @@ def numpy_ones_like_dtype_nd(context, builder, sig, args):
def ones_like(arr, dtype):
arr = np.empty_like(arr, dtype)
arr_flat = arr.flat
for idx, _ in enumerate(arr_flat):
for idx in range(len(arr_flat)):
arr_flat[idx] = 1
return arr

Expand Down

0 comments on commit 540c910

Please sign in to comment.