Skip to content

Commit 619ac7f

Browse files
committed
Replace last variable by the last value of the for loop
1 parent 4a300d7 commit 619ac7f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Lib/base64.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,20 +319,20 @@ def _85encode(b, chars, chars2, pad=False, foldnuls=False, foldspaces=False):
319319
chars[word % 85])
320320
for word in words)
321321

322-
last = None
322+
chunk = None
323323
ret = bytearray()
324324
for chunk in chunks:
325-
last = chunk
326-
ret.extend(chunk)
325+
ret += chunk
327326

328-
if last and padding and not pad:
329-
ret[-len(last):] = []
327+
# update of the last chunk afterwards
328+
if chunk and padding and not pad:
329+
ret[-len(chunk):] = []
330330

331-
if last == b'z':
332-
last = chars[0] * 5
333-
last = last[:-padding]
331+
if chunk == b'z':
332+
chunk = chars[0] * 5
333+
chunk = chunk[:-padding]
334334

335-
ret.extend(last)
335+
ret += chunk
336336

337337
return bytes(ret)
338338

0 commit comments

Comments
 (0)