George Sakkis wrote:

> Delaney, Timothy (Tim) wrote:
>> 
>> list(itertools.count()) will eventually fail with a MemoryError.
> 
> That's more of a theoretical argument on why the latter is worse. How
> many real-world programs are prepared for MemoryError every time they
> call list(), catch it and handle it graciously ? I'd say that the only
> reason an exception would be preferable in such case would be
> debugging; it's nice to have an informative traceback instead of a
> program that entered an infinite loop.

That's exactly my point. Assuming your test coverage is good, such an
error would be caught by the MemoryError. An infinite loop should also
be caught by timing out the tests, but that's much more dependent on the
test harness.

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to