Terry Hancock wrote:
>> I used to make "off by one" errors all the time in both C and Fortran,
>> whereas I hardly ever make them in Python.
Part of the reason may be that most loops over lists involve
iterators, where the details of the index limits are hidden. In
Python, you write:
for item in myList:
blah
but in C and Fortran you would write:
for (i = 0; i < MAXLIST; ++i) {
blah;
do 10 i = 1, MAXLIST
10 blah
both endpoints are mentioned explicitly. C++/STL also uses iterators,
but the syntax is repulsive.
--
http://mail.python.org/mailman/listinfo/python-list