---- Original Message -----
> From: Mark Lawrence <breamore...@yahoo.co.uk> > To: tutor@python.org > Cc: > Sent: Thursday, March 5, 2015 9:54 PM > Subject: Re: [Tutor] Strengths & weaknesses of Python lists compared to "old > school" arrays [Was "Fixed Vector Array"] > > On 05/03/2015 10:07, Alan Gauld wrote: >> On 04/03/15 19:10, boB Stepp wrote: >>> wanted to address an item in a 3-dimensional array, I would use >>> something like (x, y, z) whereas the Python list form amounts to >>> [x][y][z] . >> >> That's just a syntax thing, Python could have allowed single >> bracketing of index, Guido chose to follow his mantra of explicit >> is better than implicit. Many array based languages (including C) >> also require multiple explicit indices. >> > > You could regard this a code smell in Python. Perhaps the most repeated > thing written here by beginners is something like:- > > for i in range(len(this)): > for j in range(len(that)): > for k in range(len(other)): > if mystruct[i][j][k] then: > ... > > An experienced Pythonista's code would maybe be:- > > for x in mystruct: > for y in x: > for z in y: > if z: > ... > aside from the range(len)) horror: isn't this also a matter of "putting the busiest loop on the inside of nested loops"? See also the book Code Complete: https://books.google.nl/books?id=I-83BAAAQBAJ&pg=PA643&lpg=PA643&dq=%22busiest+loop%22+inside&source=bl&ots=4ER2sPjGcq&sig=UyyxYY5LSDN4Xd5B-u-Ft7zNjpo&hl=nl&sa=X&ei=TM74VLOSBIOuPdfcgFg&ved=0CDgQ6AEwAg#v=onepage&q=%22busiest%20loop%22%20inside&f=false _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor