◐ Shell
clean mode source ↗

Message 81736 - Python tracker

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.