setting up a callback template - efficiency and simplicity

asked 2022-03-02 01:46:36 -0500

lxg gravatar image

Hello Is there a way to setup a callback template? For instance, if I need about 10 callbacks, that will handle data from 10 different topics but all do the same thing. What is the most efficient pythonic way to set this up. All the callbacks will be performing a similar task.

I want something of the following form:

def _callback(datai, var1i, var2i, var3i, var4i):
    var1i = datai.propi1
    var2i = datai.propi2
    var3i = datai.propi3
    var4i = datai.propi4

where datai, is the data retrieved by a subscriber to topic i . How most efficiently can i set this up? Or do i have to just bite the bullet and manually create all the callbacks and subscribers? Any suggestions are appreciated in advance.

edit retag flag offensive close merge delete