holoviz / holoviz/param

.rx.buffer initial value issue

Open
#993 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

I'm on param

```python
import param
rx_value = param.rx(1)
rx_buffer = rx_value.rx.buffer(3)

assert rx_buffer.rx.value==[1]

rx_value = 2
assert rx_buffer.rx.value==[1, 2]
```

```bash
Traceback (most recent call last):
File "/home/jovyan/repos/private/param/script.py", line 8, in
assert rx_buffer.rx.value==[1, 2]
^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
```

I would expect the above example to work or alternatively the below example

```python
import param
rx_value = param.rx(1)
rx_buffer = rx_value.rx.buffer(3)

assert rx_buffer.rx.value==[]

rx_value = 2
assert rx_buffer.rx.value==[2]
```

```bash
Traceback (most recent call last):
File "/home/jovyan/repos/private/param/script.py", line 5, in
assert rx_buffer.rx.value==[]
^^^^^^^^^^^^^^^^^^^^^^
AssertionError
```

**I believe its not logical to have the initial value in the buffer but discard it when the next element is added.** Either it should not be included at all or it should be included until discarded by the buffer size.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.