13 Oct
2011
13 Oct
'11
6:39 a.m.
Guido van Rossum wrote:
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'Decimal' object cannot be interpreted as an integer
range(int(Decimal(10)))
range(0, 10)
It refuses to work on floats, too, even if they happen to have integer values:
range(1.0, 10.0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'float' object cannot be interpreted as an integer
If we think that's a good idea, presumably the same thing ought to apply to Decimals. Or are Decimals supposed to be more "exact" than floats somehow? -- Greg