Changes between Version 1 and Version 2 of Ticket #21894
- Timestamp:
- 11/18/16 05:04:08 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #21894 – Description
v1 v2 1 1 The following is a common pattern in implementations of `__cmp__` or `__eq__`: 2 2 {{{ 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__)8 3 sage: search_src("__dict__ == ") 9 4 categories/poor_man_map.py:93: return self.__class__ is other.__class__ and self.__dict__ == other.__dict__ … … 20 15 * Instances that would be considered equal but have different elements in their cache are not detected as being equal anymore. 21 16 * A restored pickle contains a `PickledMethod` which is not considered the same as the `CachedMethodCaller(NoArgs)` in the original object. 17 18 The instances which use this in their implementations of `__cmp__` seem to be limited to `doctest/`. There, such an implementation should be fine: 19 {{{ 20 sage: search_src("cmp\(self.__dict__,") 21 doctest/control.py:139: return cmp(self.__dict__,other.__dict__) 22 doctest/parsing.py:458: return cmp(self.__dict__, other.__dict__) 23 doctest/sources.py:152: return cmp(self.__dict__, other.__dict__) 24 doctest/util.py:193: return cmp(self.__dict__, other.__dict__) 25 }}}