Message93222
You're seeing the difference between str(.1) and repr(.1). When
printing the tuple, you're getting the str of the tuple but just the
repr of its contents ('%.17g'). When printing the number directly,
you're just getting the str of the number which is rounded to fewer
decimal places for display ('%.12g').
This is easily seen with a number like pi:
>>> from math import *
>>> print(pi)
3.14159265359
>>> print((pi,))
(3.141592653589793,)
>>> repr(pi)
'3.141592653589793'
>>> str(pi)
'3.14159265359'
In Py3.1, the repr computation was changed to show the shortest string
the where float(x)==x. In the case of .1, the repr and str value happen
to be the same (that is why Eric sees no difference in 3.1). |
|
Date |
User |
Action |
Args |
2009-09-28 18:14:09 | rhettinger | set | recipients:
+ rhettinger, mark.dickinson, eric.smith, scientist47 |
2009-09-28 18:14:08 | rhettinger | set | messageid: <1254161648.81.0.240027644246.issue7010@psf.upfronthosting.co.za> |
2009-09-28 18:14:07 | rhettinger | link | issue7010 messages |
2009-09-28 18:14:06 | rhettinger | create | |
|