On Tue, Mar 31, 2009 at 7:13 PM, Lada Kugis <lada.ku...@gmail.com> wrote: > On Tue, 31 Mar 2009 21:13:05 -0400 (CLT), "andrew cooke" > <and...@acooke.org> wrote: > >>Lada Kugis wrote: >>> I'm coming from fortran and >> *********** c *********** >>> background so I'm certainly biased by >>> them. But if you could explain one thing to me: >> >>but this is exactly the same behaviour as the standard way of doing things >>in c! >> >>int a[5]; >>for (i = 0; i < 5; ++i) { >> a[i] = 0; >>} >> >>were you being honest about the c background?! >> > > :-) > Yes, I usually avoid lyes. They are hard to remember. > > In C you can do it either way
Sort of, but it's *really* not idiomatic. You'd have to declare the arrays to be one longer than they actually are so that array[N] is a valid index. And then you'd end up not using the true first element of the array. Not to mention most library functions use 0-numbering, so you'd have to work around that as well. So, it can be done, but you're going against the grain of the language. Cheers, Chris -- I have a blog: http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list