Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Python Client inheritance

Hi Alexis,

That sounds like a good idea. I confess that inheritance isn't
something I really use so it may have been possible in the past and
I've broken it.

I'd be happy to accept a patch for this, please base it on the fixes
branch, add an entry to the changelog and make sure you have signed
the Eclipse CLA.



On Tue, Apr 19, 2016 at 9:38 AM, Alexis BRENON <alexis.brenon@xxxxxxx> wrote:
> Hi guys,
> I'm using the Python implementation of MQTT through the paho-mqtt package.
> The documentation says that you can inherit from the Client class to create
> your own MQTT_client. Nevertheless, inheriting from the client doesn't allow
> you to define some on_* functions directly in the class because they are
> overridden by the __init__ call of the base class...
> So, there is any particular reason the define Client.on_* to None in the
> __init__ instead of using classical member functions like this :
> class Client(object):
>     def __init__(self, ...):
>         ...
>         # Nothing about self.on_*
>     def on_*(self, ...):
>         pass
> An implementation like this would not break the actual behavior (you can
> redefine function, using mqttc.on_connect = my_new_connect_function), and it
> would be easier to inherit, defining overriding on_* functions in the
> sub-class.
> If this seems a good idea, I propose myself to do the patch.
> Kind regards,
> Alexis BRENON
> --
> Doctorant sur le projet CASSIE (
> Équipe GETALP (
> Laboratoire d'Informatique de Grenoble (
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit

Back to the top