Last active
February 14, 2017 15:29
-
-
Save caffeine-potent/99e1d021c7fb71af2afce4f3947457fb to your computer and use it in GitHub Desktop.
Dynamic Allocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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