[Numpy-discussion] numpy ring buffer

Daniele Nicolodi daniele at grinta.net
Mon May 6 05:39:15 EDT 2013


On 06/05/2013 11:01, Robert Kern wrote:
> np.roll() copies all of the data every time. It does not return a
> view.

Are you sure about that?  Either I'm missing something, or it returns a
view in my testing (with a fairly old numpy, though):

In [209]: np.__version__
Out[209]: '1.6.2'

In [210]: v1 = np.arange(10)

In [211]: v1.flags['OWNDATA']
Out[211]: True

In [212]: v2 = np.roll(v1, -1)

In [213]: v2.flags['OWNDATA']
Out[213]: False


Cheers,
Daniele




More information about the NumPy-Discussion mailing list