Python AwkwardArray: How to define a cyclic array?

189 Views Asked by At

I have been searching for a way to create a:

  • Bounded

  • Cyclic

  • Contiguous

  • numpyable API'ed

array.

I came across AwkwardArray, but was not able to make sense of the doc, which is very verbose, but unindexed for my term.

I would like to define an array and use it, just like I would a deque [with numpy API, using shape]

from collections import deque

d = deque(maxlen=10)
for i in range(20):
    d.append(i)

assert d.shape[0] == 10

I don't want a deque because it it a doubly linked list which is slow for slicing.

How to do this with AwkwardArray, with contiguous memory?

0

There are 0 best solutions below