In article <[EMAIL PROTECTED]>,
 "Carl Banks" <[EMAIL PROTECTED]> wrote:

> 1. This is fine in a perfect world where all code clearly conforms to
> expectation.  Problem is, a lot doesn't.  I think it's quite easy to
> accidentally check something intended as an iterable for emptiness.
> And, as I've explained in other posts, this can lead to subtle bugs.
> Whereas if you check for emptiness using len, it throws an exception
> right away, no bugs.  It's safer to use len.  (Safest of all is not to
> check for emptiness at all.)

Yes, it's clearly more direct to catch IndexError, than to
try to anticipate it.

   Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to