From ad295e8d3eab03aeea8956929046ef73edcbd69d Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Thu, 23 Aug 2018 20:44:31 -0500 Subject: [PATCH] Code review: succint and pythonic statements --- evennia/utils/evform.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/evennia/utils/evform.py b/evennia/utils/evform.py index 8a9828bc17..3742f50da2 100644 --- a/evennia/utils/evform.py +++ b/evennia/utils/evform.py @@ -161,21 +161,12 @@ def _to_rect(lines): lines (list): list of `ANSIString`s Returns: - nlines (list): list of `ANSIString`s of + (list): list of `ANSIString`s of same length as the longest input line """ - maxl = 0 - for line in lines: - if isinstance(line, (ANSIString, basestring)): - maxl = max(len(line), maxl) - else: - raise ValueError() - nlines = [] - for line in lines: - line += ' ' * (maxl - len(line)) - nlines.append(line) - return nlines + maxl = max(len(line) for line in lines) + return [line + ' ' * (maxl - len(line)) for line in lines] def _to_ansi(obj, regexable=False):