docs on for-loop with no __iter__?

Steven Bethard steven.bethard at gmail.com
Sat Sep 4 23:18:53 CEST 2004


Andrew Dalke <adalke <at> mindspring.com> writes:
> http://docs.python.org/ref/sequence-types.html
> 
> ] Note: for loops expect that an IndexError will be
> ] raised for illegal indexes to allow proper detection
> ] of the end of the sequence.

Thanks, that's what I was looking for.  I knew it had to be around there 
somewhere.  =)  Presumably there was a reason not to use len() to determine 
the end of the sequence?

Steve





More information about the Python-list mailing list