dcc.Store query

I think that you can probably manage it through pattern-matching as well.

Either way, is going to be tricky.

One of my favorite ways of dealing with stuff is by creating a dictionary of the opts and functions.

myDict = {'opt1': func1(), 'opt2': func2(), 'criteria1': func3()}

Then instead of using if statements, you just return the function that matches the criteria by:

return myDict[opts]

Also, another tip, if you set the function up to be a variable, you can pass arguments to it like you are calling the function:

myFunc = myDict[opts]

return myFunc(*args)
1 Like