Mark Dickinson <dicki...@gmail.com> added the comment: Thanks for the feedback; I've added 2.6, 2.7, 3.1 to the versions and will backport.
[Eric] > Since you're calling int() on the result, can't this code: > self._int = str(int((intpart+fracpart).lstrip('0') or '0')) > just be: > self._int = str(int(intpart+fracpart)) > ? Yes! Thank you. I'm not sure what (if anything) I was thinking here. The str(int(...)) hack is quite an ugly way to normalize a string; it also has the drawback of taking time quadratic in the length of the input. In its defence: (a) I can't think of anything better; (b) this change seems to have no noticeable effect on the time to run the test- suite, and (c) since all the arithmetic operations use string <-> int conversions anyway the quadratic time behaviour doesn't really make things any worse than they already are. > And here, you already know diag is not None, so do you need the "or '0'" > part? > self._int = str(int(diag or '0')).lstrip('0') I think *something* like this is needed, since diag can legitimately be the empty string. It might be clearer as a proper if block, though: 'if diag: ... else: ...'. ---------- versions: +Python 2.6, Python 2.7, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6595> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com