1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Use extend instead of for loop

This commit is contained in:
Alex Forencich 2017-05-18 13:35:42 -07:00
parent aebe0549dd
commit 3b0cfbbfed
2 changed files with 4 additions and 6 deletions

View File

@ -90,9 +90,8 @@ def cobs_decode(block):
i += 1
if i+code-1 > len(block):
return None
for k in range(code-1):
dec.append(block[i])
i += 1
dec.extend(block[i:i+code-1])
i += code-1
if code < 255 and i < len(block):
dec.append(0)

View File

@ -91,9 +91,8 @@ def cobs_decode(block):
i += 1
if i+code-1 > len(block):
return None
for k in range(code-1):
dec.append(block[i])
i += 1
dec.extend(block[i:i+code-1])
i += code-1
if code < 255 and i < len(block):
dec.append(0)