Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30737

Re: fastest data structure for retrieving objects identified by (x,y) tuple?

From Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Newsgroups comp.lang.python
Subject Re: fastest data structure for retrieving objects identified by (x,y) tuple?
Date 2012-10-04 18:11 +0200
Organization A newly installed InterNetNews server
Message-ID <k4kcfn$732$1@r03.glglgl.gl> (permalink)
References <mailman.1777.1349303447.27098.python-list@python.org> <506ced38$0$29978$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

fastest data structure for retrieving objects identified by (x,y) tuple? Benjamin Jessup <bsj@abzinc.com> - 2012-10-03 18:30 -0400
  Re: fastest data structure for retrieving objects identified by (x,y) tuple? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 01:58 +0000
    Re: fastest data structure for retrieving objects identified by (x,y) tuple? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 02:25 +0000
    Re: fastest data structure for retrieving objects identified by (x,y) tuple? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-04 18:11 +0200
      Re: fastest data structure for retrieving objects identified by (x,y) tuple? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 23:37 +0000

csiph-web