numpy_ringbuffer
numpy_ringbuffer copied to clipboard
Negative indices in unfull buffers unsafely access memory
In a partly-full buffer, if you take a negative index, it will refer that index to the end of the full length of the buffer as apposed to the end of the full portion of the buffer.
from numpy_ringbuffer import RingBuffer
r = RingBuffer(10)
for i in range(5):
r.append(i)
print(r[-1])
# 3.5097786643241087e+64