I want to be able to \'build\' a numpy array on the fly, I do not know the size of this array in advance.
For example I want to do something like this:
Since y is an iterable I really do not see why the calls to append:
a = np.array(list(y))
will do and it's much faster:
import timeit
print timeit.timeit('list(s)', 's=set(x for x in xrange(1000))')
# 23.952975494633154
print timeit.timeit("""li=[]
for x in s: li.append(x)""", 's=set(x for x in xrange(1000))')
# 189.3826994248866