conatraints on "for" magic?
Greg Weeks
weeks at golden.dtc.hp.com
Wed Jul 26 11:51:16 EDT 2000
Alex Martelli (alex at magenta.com) wrote:
: I believe you are correct in noticing that nowhere is it
: clarified that this is the specific method used by the for statement,
: and that IndexError is the way __getitem__ tells the for statement
: that the sequence is finished
Well, thank *you* for the clarification.
It is interesting to note that if I were to define a sequence type that was
index-one-based, the for loop would consider it empty.
Regards,
Greg
More information about the Python-list
mailing list