[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] bidimensional arrays or the quick way to maps



pistacchio wrote:

tile_map[x][y] = tile_number

now, probably i'm missing a basic feature of python, but it seems to lack of a native support for multidimensional arrays.

There's nothing built-in (yet -- there might be in py3k).

If you just want to be able to write x[i,j] instead of
x[i][j], there are two things you can do:

a) use a dict instead of lists (the key is a tuple)

b) write your own wrapper class with __getitem__ and
   __setitem__ methods that take a tuple.

--
Greg