Message91092
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: ...'. |
|
Date |
User |
Action |
Args |
2009-07-30 10:10:36 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, eric.smith, ezio.melotti |
2009-07-30 10:10:36 | mark.dickinson | set | messageid: <1248948636.41.0.35710764805.issue6595@psf.upfronthosting.co.za> |
2009-07-30 10:10:34 | mark.dickinson | link | issue6595 messages |
2009-07-30 10:10:33 | mark.dickinson | create | |
|