<SNIP>
I haven't looked carefully at your code but there's always a smell in
Python when you see structure[x][y]. Can you change the grid so you
always write something like:-
for row in grid:
for cell in row:
process(cell)
I say this as I'm all for short term pain, long term gain, especially
when it's guaranteed to eliminate "list index out of range" errors.
I think in this case I have to say no. I purposely wrote those "proc" or
"procedurally" style functions to ensure that access to the grid in this
way would result in the correct output from id, and to test that it
worked as expected.
However there are other places in my code where I think I can eliminate
this smell such as the new function that drops the non-zero values.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor