[Twisted-Python] Some "spread" objects and comparison semantics
I'm analysing the code in twisted/spread/flavors.py and twisted/spread/pb.py, trying to remove the __cmp__ and cmp() in RemoteCache, RemoteCacheMethod and RemoteCacheObserver classes. They all have __cmp__ methods, but as there is not any test for these, and it's not specified in the documentation, I don't know if the comparison method is to compare by equality, or for these objects to be orderable. Yes, I could replace __cmp__ with the full rich comparison battery, but it's not worth it if the semantic of these objects will not use it. Thanks! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/
On 10 May, 06:51 pm, facundobatista@gmail.com wrote:
I'm analysing the code in twisted/spread/flavors.py and twisted/spread/pb.py, trying to remove the __cmp__ and cmp() in RemoteCache, RemoteCacheMethod and RemoteCacheObserver classes.
They all have __cmp__ methods, but as there is not any test for these, and it's not specified in the documentation, I don't know if the comparison method is to compare by equality, or for these objects to be orderable.
Yes, I could replace __cmp__ with the full rich comparison battery, but it's not worth it if the semantic of these objects will not use it.
I doubt anyone remembers the rationale for these methods. We should err on the safe side and preserve the existing behavior. Jean-Paul
On Wed, May 11, 2011 at 2:05 PM, <exarkun@twistedmatrix.com> wrote:
I doubt anyone remembers the rationale for these methods. We should err on the safe side and preserve the existing behavior.
Ok, I'll add tests to check this also. -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/
On May 11, 2011, at 1:05 PM, exarkun@twistedmatrix.com wrote:
I doubt anyone remembers the rationale for these methods. We should err on the safe side and preserve the existing behavior.
I should point out that this isn't erring, technically, according to <http://twistedmatrix.com/trac/wiki/CompatibilityPolicy>. For a given behavior whose implementation you want to change, you always have to preserve the behavior, in case someone is depending on it. If you think some behavior is a really bad idea (and I don't necessarily think sortability/comparability is a bad idea) you can always deprecate it, but you have to preserve it while it's deprecated. Thanks for asking, though, Facundo! -glyph
participants (3)
-
exarkun@twistedmatrix.com -
Facundo Batista -
Glyph Lefkowitz