[issue5032] itertools.count step
Mark Dickinson
report at bugs.python.org
Thu Feb 12 11:57:49 CET 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
A couple of comments:
> Also, improved the utility over its cousin, range() by allowing floating
> point arguments.
Is this wise? From a numerical perspective, it seems to me that using
count with floating-point arguments is almost always going to be the
wrong thing to do (unless those floats are integral), and that allowing
floating-point arguments invites misuse. For example, I'd be suspicious
of code that looked like:
for x in count(0.0, 0.1):
do_something_with_x
where it seems quite likely that what's intended is the more robust:
for i in count():
x = i/10.0
do_something_with_x
Second (unrelated) comment: on my machine, list(count()) appears to
hang, and is unresponsive to keyboard interrupts. Is there any easy way
to make this interruptible? While list(count()) is clearly a stupid
thing to type, it would be nice if it didn't hang the interpreter.
----------
nosy: +marketdickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5032>
_______________________________________
More information about the Python-bugs-list
mailing list