Access all classes in a directory, put into an array, and print them out
Stephen Boulet
spboulet at speakeasy.net
Tue Jul 3 22:51:06 EDT 2001
Tim Hammerquist wrote:
[snip]
> People are just as capable of writing bad Perl code as they are of
> writing bad Python code. You've heard of people writing this?
>
> for i in range(len(array)):
> process(array[i])
>
> Of course, once you know a little more it becomes:
>
> for item in array:
> process(item)
Ok, how would you write this if you actually needed the index of array in
your for loop?
My (ugly looking) solution; I hope there's something better:
i = 0
for item in array:
process(item)
someFunction(i)
i = i + 1
-- Stephen
More information about the Python-list
mailing list