Skip to content

Instantly share code, notes, and snippets.

@caffeine-potent
Last active February 14, 2017 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caffeine-potent/99e1d021c7fb71af2afce4f3947457fb to your computer and use it in GitHub Desktop.
Save caffeine-potent/99e1d021c7fb71af2afce4f3947457fb to your computer and use it in GitHub Desktop.
Dynamic Allocation
class B:
def __init__(self):
self.data = []
def update(self, row):
for r in row:
self.data.append(r)
def finalize(self):
return np.reshape(self.data, newshape=(len(self.data)/5, 5))
ax = B()
for j in range(1000000000):
ax.update([1,2,3,4,5])
ax.finalize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment