How to make this faster

Fábio Santos fabiosantosart at gmail.com
Fri Jul 5 11:18:41 EDT 2013


On 5 Jul 2013 15:59, "Helmut Jarausch" <jarausch at 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):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130705/29eba2d7/attachment.html>


More information about the Python-list mailing list