Sequence-length - Missing the obvious ?

Peter Schneider-Kamp petersc at stud.ntnu.no
Fri Jun 2 15:20:44 EDT 2000


mlauer at trollinger-fe.rz.uni-frankfurt.de wrote:
> 
> But why ? How does the for loop knows
> how much elements the sequence contains ?
> I did not program the __len__ function,
> so... how ?

As far as I understand the for loop goes on until an
IndexError is raised. Then the error is cleared and
the for loop ends.

Nice feature, if you ask me.

makes-extending-error-messages-more-complicated-though-ly y'rs
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list