From f9cf3e324e88f14c1f2686e9e06a956068a1a72b Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Fri, 22 Nov 2013 10:41:38 +0000 Subject: [PATCH] Tidyied imports, removed use of itertools.repeat --- cipher.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cipher.py b/cipher.py index 6f72c26..865a1b9 100644 --- a/cipher.py +++ b/cipher.py @@ -1,11 +1,7 @@ import string import collections -# import norms import logging -# import math -from itertools import zip_longest, repeat, cycle -# from segment import segment -# from multiprocessing import Pool +from itertools import zip_longest, cycle logger = logging.getLogger(__name__) @@ -94,7 +90,7 @@ def transpose(items, transposition): >>> transpose([10,11,12,13,14,15], (3,2,4,1,5,0)) [13, 12, 14, 11, 15, 10] """ - transposed = list(repeat('', len(transposition))) + transposed = [''] * len(transposition) for p, t in enumerate(transposition): transposed[p] = items[t] return transposed @@ -109,7 +105,7 @@ def untranspose(items, transposition): >>> untranspose([13, 12, 14, 11, 15, 10], [3,2,4,1,5,0]) [10, 11, 12, 13, 14, 15] """ - transposed = list(repeat('', len(transposition))) + transposed = [''] * len(transposition) for p, t in enumerate(transposition): transposed[t] = items[p] return transposed -- 2.34.1