From f5647d9d7af1e2a9bc22c965840e4f8bb468543f 2012-01-05 13:43:59 From: Thomas Kluyver Date: 2012-01-05 13:43:59 Subject: [PATCH] Use inplace addition in ultratb. --- diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index bb11204..d3518ea 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -514,7 +514,7 @@ class ListTB(TBTools): Colors.lineno, lineno, Colors.Normal, Colors.name, name, Colors.Normal) if line: - item = item + ' %s\n' % line.strip() + item += ' %s\n' % line.strip() list.append(item) # Emphasize the last entry filename, lineno, name, line = extracted_list[-1] @@ -525,7 +525,7 @@ class ListTB(TBTools): Colors.nameEm, name, Colors.normalEm, Colors.Normal) if line: - item = item + '%s %s%s\n' % (Colors.line, line.strip(), + item += '%s %s%s\n' % (Colors.line, line.strip(), Colors.Normal) list.append(item) #from pprint import pformat; print 'LISTTB', pformat(list) # dbg @@ -564,7 +564,7 @@ class ListTB(TBTools): if value.text is not None: i = 0 while i < len(value.text) and value.text[i].isspace(): - i = i+1 + i += 1 list.append('%s %s%s\n' % (Colors.line, value.text.strip(), Colors.Normal)) @@ -572,9 +572,9 @@ class ListTB(TBTools): s = ' ' for c in value.text[i:value.offset-1]: if c.isspace(): - s = s + c + s += c else: - s = s + ' ' + s += ' ' list.append('%s%s^%s\n' % (Colors.caret, s, Colors.Normal) )