Skip to content

__getitem__ does not obey _left_index and _right_index #5

@b4be1

Description

@b4be1

Hi @eric-wieser, simple indexing does not work as expected in combination with pop(). E.g.,

r = RingBuffer(capacity=4, dtype=np.int32)
r.extend((1,2,3,4))
r.pop()
print(r[-1])
>>> 4

One would expect to see r[-1] = 3. The reason is that simple indexing does not check whether requested index is within the range between _left_index and _right_index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions