Use set instead of list for Plane's internal collection of objects.

pull/1/head
jcushman 2012-06-22 16:36:33 -03:00
parent c7709045e9
commit da3f023b2d
1 changed files with 2 additions and 2 deletions

View File

@ -246,7 +246,7 @@ class ObjIdRange(object):
class Plane(object): class Plane(object):
def __init__(self, objs=None, gridsize=50): def __init__(self, objs=None, gridsize=50):
self._objs = [] self._objs = set()
self._grid = {} self._grid = {}
self.gridsize = gridsize self.gridsize = gridsize
if objs is not None: if objs is not None:
@ -281,7 +281,7 @@ class Plane(object):
else: else:
r = self._grid[k] r = self._grid[k]
r.append(obj) r.append(obj)
self._objs.append(obj) self._objs.add(obj)
return return
# remove(obj): displace an object. # remove(obj): displace an object.