Commit 883dd065 authored by Thomas Albrecht's avatar Thomas Albrecht

Clusters is now iterable

parent 0784b191
......@@ -34,7 +34,8 @@ class Clusters(object):
self.n = (self.delta / size).int() + 1
#self.list = []
self._clusters = [[self.init_cluster(vec2d(i,j)) for j in range(self.n.y)] for i in range(self.n.x)]
self._clusters = [[self.init_cluster(vec2d(i,j))
for j in range(self.n.y)] for i in range(self.n.x)]
# for i in range(self.nx * self.ny):
# self.list.append([])
......@@ -69,6 +70,13 @@ class Clusters(object):
return self._clusters[I.x][I.y]
#def __len__(self):
# return len(self._clusters)
def __iter__(self):
for each_list in self._clusters:
for item in each_list: yield item
def append(self, anchor, obj):
#print "appending at pos", X
#print " to ", self(X)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment