python for loop
lada.kugis at gmail.com
Wed Apr 1 02:44:26 CEST 2009
On Wed, 01 Apr 2009 02:24:45 +0200, Lada Kugis <lada.kugis at gmail.com>
>I'm coming from fortran and c background so I'm certainly biased by
>them. But if you could explain one thing to me:
>in fortran for example:
>goes from 1,2,3,4,...,n
And of course, lapsus calami, this is wrong and it should go like:
do 1 i=1,n
... goes from ...
>in python for example:
>for i in range(1,n)
>goes from 1,2,3,4,...,n-1
>(that is, it goes from 1 up to, but not including n)
>Why is that so ? What were the reasons for that "not including" part ?
>It troubles me greatly, and I cannot see it's advantages over the
>"standard" "up to and including" n.
More information about the Python-list