[Edu-sig] Sample Data Structure

kirby urner kirby.urner at gmail.com
Tue Jun 27 04:40:04 CEST 2006


> I doubt if it is a good choice to use a dictionary here, as this is not
> an ordered data
> structure and interchanging the layers of  the cube will certainly make
> the cube
> imperfect.

Yes, I think you're right. I was trying to advertise dictionary
syntax, but not appropriately in this case.  My earlier draft was
nested tuples, and I could have stuck with that, but thought it too
boring.

A more complete module would also have audit code that actually summed
all the rows, columns and diagonals, and spit out 315 every time.

I've written most of this auditing code, but decided the bare data
would be better.

Even though it comes as a dict, a quick couple of lines could force a
more ordered approach, demonstrating how you don't have to "live with"
the data structure another programmer chose, if you can think of a
better one.

An important lesson.

xTurtle is way cool by the way.  I've got the __init__.py to make it a
package.  It could go in the standard library directory that way, for
a Pythonic edudistro.

Kirby


More information about the Edu-sig mailing list