In my current work i use Numpy and list comprehensions a lot and in the interest of best possible performance i have the following questions:
What actually happens b
You could create your own list and experiment with it to shed some light on the situation...
>>> class my_list(list):
... def __init__(self, arg):
... print 'spam'
... super(my_list, self).__init__(arg)
... def __len__(self):
... print 'eggs'
... return super(my_list, self).__len__()
...
>>> x = my_list([0,1,2,3])
spam
>>> len(x)
eggs
4
>>> import numpy as np
>>> np.array(x)
eggs
eggs
eggs
eggs
array([0, 1, 2, 3])
>>> np.fromiter(x, int)
array([0, 1, 2, 3])
>>> np.array(my_list([0,1,2,3]))
spam
eggs
eggs
eggs
eggs
array([0, 1, 2, 3])