[issue1533] Bug in range() function for large values
Mark Dickinson
report at bugs.python.org
Sat May 1 02:53:40 CEST 2010
Mark Dickinson <dickinsm at gmail.com> added the comment:
Currently, in trunk, I get:
>>> range(0.0, 11.0, 1.1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: range() integer start argument expected, got float.
But with Alexander's patch on trunk, I get:
>>> range(0.0, 11.0, 1.1)
[0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L]
I'm not sure whether this is intentional or not, but IIRC it was a very deliberate choice not to allow float arguments to range (especially when, as here, the arguments are simply being truncated). I don't think this is an acceptable change for 2.7 (still less for 2.6).
Any patch for this issue should not change the behaviour for small arguments.
IMO, the *right* solution is to convert arguments via __index__ when possible (as 3.x appears to already do). However, this would be a new feature. I suggest closing this as a 'won't fix'.
----------
stage: -> unit test needed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1533>
_______________________________________
More information about the Python-bugs-list
mailing list