Skip to main content

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

Jason Swails
Project Software Engineer
Ext. 1680

> -----Original Message-----
> From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-
> bounces@xxxxxxxxxxx] On Behalf Of Alexis BRENON
> Sent: Wednesday, April 20, 2016 4:42 AM
> To: paho-dev@xxxxxxxxxxx
> Subject: Re: [paho-dev] Python Client inheritance

> I agree with your first proposal, but to prevent API break, you can define
> on_* callbacks as just empty functions in the base Client() class, for example :
> class Client:
> 	...
> 	def on_connect(self, client, userdata, flag, rc):
>          	"""Called when the broker responds to our connection request.
>          	This function may be overridden by sub-classes.
> 	        client:     the client instance for this callback
>          	userdata:   the private user data as set in Client() or userdata_set()
> 	        flags:      response flags sent by the broker
> 	        rc:         the connection result
> 	        """
> 	        pass
> 	...

This is precisely the API breakage I was referring to.  The old "on_connect" was Falsy, this one is Truthy, the old one could be tested for implementation without calling it, this one can't.  If any program based on this library utilizes one (or both) of those two properties, this change breaks their code.  As an example, this project itself internally depended on that behavior (although you fixed that in your PR).  But since it was part of the public-facing API, it's unsure whether other projects depend on this as well.

For the most part, this discussion has been moved to GitHub (for the interested parties only listening here).


Back to the top