From 41b748d4ced632131e9edf607d9e32cd590fa464 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 3 Jan 2019 02:30:49 +0300 Subject: [PATCH] xrange is preferrable for dozen-elements lists --- pyderasn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyderasn.py b/pyderasn.py index 1c7f3ed..1245a43 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -1325,7 +1325,7 @@ def _colourize(what, colour, with_colours, attrs=("bold",)): def colonize_hex(hexed): """Separate hexadecimal string with colons """ - return ":".join(hexed[i:i + 2] for i in range(0, len(hexed), 2)) + return ":".join(hexed[i:i + 2] for i in six_xrange(0, len(hexed), 2)) def pp_console_row( @@ -1432,7 +1432,7 @@ def pp_console_blob(pp, decode_path_len_decrease=0): cols.append(" ." * (decode_path_len + 1)) if isinstance(pp.blob, binary_type): blob = hexenc(pp.blob).upper() - for i in range(0, len(blob), 32): + for i in six_xrange(0, len(blob), 32): chunk = blob[i:i + 32] yield " ".join(cols + [colonize_hex(chunk)]) elif isinstance(pp.blob, tuple): @@ -5431,7 +5431,7 @@ def generic_decoder(): # pragma: no cover choice = PrimitiveTypes() choice.specs["SequenceOf"] = SequenceOf(schema=choice) choice.specs["SetOf"] = SetOf(schema=choice) - for i in range(31): + for i in six_xrange(31): choice.specs["SequenceOf%d" % i] = SequenceOf( schema=choice, expl=tag_ctxc(i), -- 2.44.0