From 54b1d1d62cd1b7bfc8898aeedb6db92596b46025 Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Tue, 22 Nov 2016 01:48:25 +0100 Subject: [PATCH] Small refactoring --- wafo/polynomial.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/wafo/polynomial.py b/wafo/polynomial.py index f0f7f48..7033211 100644 --- a/wafo/polynomial.py +++ b/wafo/polynomial.py @@ -740,19 +740,15 @@ def poly2str(p, variable='x'): def _coefstr_0(coefstr, k): if coefstr != '0': - newstr = '{0:s}'.format(coefstr) - else: - newstr = '0' if k == 0 else '' - return newstr + return '{0:s}'.format(coefstr) + return '0' if k == 0 else '' def _coefstr_1(coefstr, var): if coefstr == '0': - newstr = '' - elif coefstr in ['b', '1']: - newstr = var - else: - newstr = '{0:s}*{1:s}'.format(coefstr, var) - return newstr + return '' + if coefstr in ['b', '1']: + return var + return '{0:s}*{1:s}'.format(coefstr, var) def _coefstr_n(coefstr, var, power): if coefstr == '0':