fastest data structure for retrieving objects identified by (x, y) tuple?
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Thu Oct 4 12:11:28 EDT 2012
Am 04.10.2012 03:58 schrieb Steven D'Aprano:
> alist = [[None]*2400 for i in range(2400)]
> from random import randrange
> for i in range(1000):
> x = randrange(2400)
> y = randrange(2400)
> adict[(x, y)] = "something"
> alist[x][y] = "something"
> The actual sizes printed will depend on how sparse the matrices are, but
> for the same above (approximately half full),
I wouldn't consider 1000 of 5760000 "half full"...
Thomas
More information about the Python-list
mailing list