You might want to use this syntax:
board[(x, y)]
It is less pretty, but it allows you to have multidimensional arrays simply. Any number of measurements:
board[(1,6,34,2,6)]
By creating a defaultdict board, you can even have sparse dictionaries:
board[(1,6,34,2,6)] >>> from collections import defaultdict >>> board = defaultdict(lambda: 0) >>> board[(1,6,8)] = 7 >>> board[(1,6,8)] 7 >>> board[(5,6,3)] 0
If you need something more advanced than you probably want NumPy .
Lennart Regebro
source share