This next behaviour befuddles me, any explanation would be appreciated.
>>> a = (0.1457164443693023, False)
>>> print a
(0.1457164443693023, False)
>>> print a[0]
0.145716444369
Using python 2.7
This next behaviour befuddles me, any explanation would be appreciated.
>>> a = (0.1457164443693023, False)
>>> print a
(0.1457164443693023, False)
>>> print a[0]
0.145716444369
Using python 2.7
The only difference is the print
. The number doesn't change, just its representation. You can reduce your problem to:
>>> 0.1457164443693023
0.1457164443693023
>>> print 0.1457164443693023
0.145716444369
(I guess (and this is only and merely a guess) this boils down to __repr__
vs __str__
or something along this line)
The first calls __ repr __ , the second __ str __
a = (0.1457164443693023, False)
print a
>>> (0.1457164443693023, False)
print a[0]
>>> 0.145716444369
print repr(a[0])
>>> 0.1457164443693023
print str(a[0])
>>> 0.145716444369
For some design reason Double.__ str __() returns fewer decimals.
Looks like python does not print the full accuracy of a float, but it is still there.
>>> a = (0.1457164443693023, False)
>>> print a
(0.1457164443693023, False)
>>> print repr(a[0])
0.1457164443693023