On Fri, 05 Jul 2013 16:18:41 +0100, Fábio Santos wrote:

> On 5 Jul 2013 15:59, "Helmut Jarausch" <jarau...@igpm.rwth-aachen.de> wrote:
>>
>> On Fri, 05 Jul 2013 13:44:57 +0100, Fábio Santos wrote:
>> May I suggest you avoid range and use enumerate(the_array) instead? It
>> might be faster.
>>
>> How does this work?
>>
>> Given
>>
>> Grid= [[0 for j in range(9)] for i in range(9)]
>>
>> for (r,c,val) in ????(Grid) :
>>
>> Helmut
> 
> for r, row_lst in enumerate(Grid):
>     for c, val in enumerate(row_lst):

This is only slightly faster. I assume the creation of the temporary lists 
"row_list"
is a bit expensive.
Taking 5.4 seconds it's much slower than the current champion ( 0.79 seconds )

Thanks,
Helmut.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to