mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Removed < <= > >= from the API. Implemented as comparisons of the
underlying dictionaries, there were no reasonable use cases (lexicographic sorting of a list of sets is somewhat esoteric). Frees the operators for other uses (such as strict subset and superset comparisons). Updated documentation and test suite accordingly.
This commit is contained in:
parent
bf935fde15
commit
e87ab3fefe
3 changed files with 5 additions and 23 deletions
19
Lib/sets.py
19
Lib/sets.py
|
@ -102,16 +102,7 @@ class BaseSet(object):
|
|||
"""
|
||||
return self._data.iterkeys()
|
||||
|
||||
# Comparisons. Ordering is determined by the ordering of the
|
||||
# underlying dicts (which is consistent though unpredictable).
|
||||
|
||||
def __lt__(self, other):
|
||||
self._binary_sanity_check(other)
|
||||
return self._data < other._data
|
||||
|
||||
def __le__(self, other):
|
||||
self._binary_sanity_check(other)
|
||||
return self._data <= other._data
|
||||
# Equality comparisons using the underlying dicts
|
||||
|
||||
def __eq__(self, other):
|
||||
self._binary_sanity_check(other)
|
||||
|
@ -121,14 +112,6 @@ class BaseSet(object):
|
|||
self._binary_sanity_check(other)
|
||||
return self._data != other._data
|
||||
|
||||
def __gt__(self, other):
|
||||
self._binary_sanity_check(other)
|
||||
return self._data > other._data
|
||||
|
||||
def __ge__(self, other):
|
||||
self._binary_sanity_check(other)
|
||||
return self._data >= other._data
|
||||
|
||||
# Copying operations
|
||||
|
||||
def copy(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue