Curious about Dash workflow - Why does Dash not use explicit names for inputs used in custom functions?

I’m a few weeks into learning Dash and have been very surprised by some of the ways it works. I’ll try to describe it below - hopefully, there is some logic that I’m just missing :slight_smile:

I’m curious why the inputs defined in the @app.callback, and the custom functions that use them, are not named explicitly in Dash apps. It seems Dash is designed on the idea that inputs are used in the order they are listed in the callback.

An example:

@app.callback(
 Input(component_id='Slider_alpha', component_property='value'),
 Input(component_id='Slider_beta', component_property='value'),
 Input(component_id='Slider_gamma', component_property='value'),
)

def my_custom_function (variable1, variable2...):
     do something...

Here, as I understand it, the input with the component_id ‘Slider_alpha’ becomes ‘variable1’ in the custom function. Of course, it could be named more intuitively, but I see many examples of non-intuitive naming like this. So here is what I’m curious about:

  1. Inputs defined in the callback have a component_id - obviously to make it clear where each input gets its value from. In the same way, I had expected inputs for in the custom function(s) to be clearly defined - not just going by order of the definitions in the callback function

  2. There seems to be no convention for what the 'custom function is called. Is there a name for this concept, to refer to the ‘custom function’? There can of course be more than one, but that makes it even more relevant to name these input variables explicitly.

Hey @plottingly, have you seen this section of the docs?

1 Like

I had not seen this, @AIMPED , and on a quick read-through it looks like the way it seems logical to me to handle callbacks.
Thanks for the input!

2 Likes