def __call__(self, ar): p = Packer(ar) for feature, size in self.features: p.addRoom(size) p.pack() for room, (feature, size) in zip(p.rooms, self.features): r = area.Area(room.left, room.top, room.right, room.bottom) for cell in feature(r): yield cell