☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

What is the cleanest way to deal with on_change callbacks that do not use the arguments?

Community Support
Harm
Harm

More a style question. I have a lot of places where I use the on_change handle to trigger a callback. Often I do not even use information on what exactly changed.

Bokeh however requires the exact signature of three arguments. E.g. *args is not allowed:
ValueError: Callback functions must have signature func(attr, old, new), got func(*args)

an option here would be
def callback(attr, old, new):

but these are never used, to indicate that they are not used I could do
def callback(_, __, ___)

but this may perhaps not be better.

What would be in your opinion the cleanest way of dealing with the above?

⌁   Link to post
samr85
samr85

I would normally do:

def callback(_attr, _old, _new):

to indicate that the parameters aren’t used, but when someone comes to modify the function in future they can see what parameters are available to them should they need them.

⌁   Link to post

End of archived discussion · Replies are disabled