nested lists as arrays
Fredrik Lundh
fredrik at pythonware.com
Mon Feb 14 13:44:53 EST 2005
benjamin.cordes at blawrc.de wrote:
> Allright. What difference in runtime and space would it make using
> dictionaries instead?
is this for an interactive game? if so, the answer is "none at all".
(on my machine, you can make about 6000000 dict[x,y] accesses per
second, compared to 7500000 list[x][y] accesses... assuming that your
algorithm needs to check each cell on the board 10 times per move, and
you want the moves to appear "instantly", the slower solution should be
fast enough for a 250x250 board, compared to a 270x270 board for the
faster solution...).
</F>
More information about the Python-list
mailing list