3 ms·
... n = x.shape[0]
by chestervonwinch 8y ago
...
n = x.shape[0]
- quietbritishjim 8y agoOr just len(x). This works perfectly well on numpy arrays and has the bonus that it works on regular lists/tuples of floats, so the first snippet doesn't rely on numpy.