Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.rx.buffer initial value issue #993

Open
MarcSkovMadsen opened this issue Dec 26, 2024 · 0 comments
Open

.rx.buffer initial value issue #993

MarcSkovMadsen opened this issue Dec 26, 2024 · 0 comments

Comments

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Dec 26, 2024

I'm on param

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]
Traceback (most recent call last):
  File "/home/jovyan/repos/private/param/script.py", line 8, in <module>
    assert rx_buffer.rx.value==[1, 2]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

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

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]
Traceback (most recent call last):
  File "/home/jovyan/repos/private/param/script.py", line 5, in <module>
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant