Skip to content

Commit 6fcd5e4

Browse files
committed
Refactor to enumerate from "range and len" as pylint suggests
results in simpler and faster code, see #56 (comment)
1 parent 6e0c86a commit 6fcd5e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kaitaistruct.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ def process_rotate_left(data, amount, group_size):
397397
anti_amount = -amount & mask
398398

399399
r = bytearray(data)
400-
for i in range(len(r)): # pylint:disable=consider-using-enumerate
401-
r[i] = (r[i] << amount) & 0xff | (r[i] >> anti_amount)
400+
for i, byte in enumerate(r):
401+
r[i] = (byte << amount) & 0xff | (byte >> anti_amount)
402402
return bytes(r)
403403

404404
# ========================================================================

0 commit comments

Comments
 (0)