Changes between Version 1 and Version 2 of Ticket #21894


Ignore:
Timestamp:
11/18/16 05:04:08 (5 years ago)
Author:
saraedum
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21894 – Description

    v1 v2  
    11The following is a common pattern in implementations of `__cmp__` or `__eq__`:
    22{{{
    3 sage: search_src("cmp\(self.__dict__,")
    4 doctest/control.py:139:        return cmp(self.__dict__,other.__dict__)
    5 doctest/parsing.py:458:        return cmp(self.__dict__, other.__dict__)
    6 doctest/sources.py:152:        return cmp(self.__dict__, other.__dict__)
    7 doctest/util.py:193:        return cmp(self.__dict__, other.__dict__)
    83sage: search_src("__dict__ == ")
    94categories/poor_man_map.py:93:        return self.__class__ is other.__class__ and self.__dict__ == other.__dict__
     
    2015* Instances that would be considered equal but have different elements in their cache are not detected as being equal anymore.
    2116* A restored pickle contains a `PickledMethod` which is not considered the same as the `CachedMethodCaller(NoArgs)` in the original object.
     17
     18The instances which use this in their implementations of `__cmp__` seem to be limited to `doctest/`. There, such an implementation should be fine:
     19{{{
     20sage: search_src("cmp\(self.__dict__,")
     21doctest/control.py:139:        return cmp(self.__dict__,other.__dict__)
     22doctest/parsing.py:458:        return cmp(self.__dict__, other.__dict__)
     23doctest/sources.py:152:        return cmp(self.__dict__, other.__dict__)
     24doctest/util.py:193:        return cmp(self.__dict__, other.__dict__)
     25}}}