Skip to content

Commit 9c14b6b

Browse files
author
whitie
committed
Optimized checksum calculation.
1 parent 4bf51f2 commit 9c14b6b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

barcode/codex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ def _try_to_optimize(self, encoded):
215215
return encoded
216216

217217
def _calculate_checksum(self, encoded):
218-
cs = [encoded.pop(0)]
219-
for i, code_num in enumerate(encoded, start=1):
218+
cs = [encoded[0]]
219+
for i, code_num in enumerate(encoded[1:], start=1):
220220
cs.append(i * code_num)
221221
return sum(cs) % 103
222222

0 commit comments

Comments
 (0)