On Fri, Aug 11, 2017 at 6:46 AM, Barry Scott <barry.sc...@forcepoint.com>

> I porting some code to latest twisted and I;m seeing the old code expects
> to
> call loseConenction with a reason.

This code makes the mistake of treating a peculiarity of a particular
implementation of an interface as the interface itself.

> But loseConnection in class ConnectionMixin does not have the parameter.

Nor does the definition of loseConnection on the interface:


> Is this an oversight or deliberate?

Code that goes beyond the guarantees of the interface is limiting itself to
working with a particular implementation.  Sometimes it is less than clear
whether some behavior is intended to be guaranteed by the interface or not
- but in this case, it's pretty clear.  loseConnection accepts no
arguments.  Code that passes an argument may work with a specific
implementation but there's no guarantee it will work with other
implementations.  And "other implementations" includes "future versions of
a specific implementation".

So, it's deliberate.  If you want to make the application code in question
more portable across implementations, it should stop passing an argument.

Twisted-Python mailing list

Reply via email to