Skip to content

Commit

Permalink
move clear() method out of base class
Browse files Browse the repository at this point in the history
...so that dict.clear() and list.clear()
can have different docstrings.
  • Loading branch information
wbolster committed Jul 2, 2017
1 parent dc0a109 commit f3088c6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/sanest/sanest.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,6 @@ def __delitem__(self, path_like):
except LookupError as exc:
raise typeof(exc)(path) from None

def clear(self):
"""
Clear this container; like ``dict.clear()`` and ``list.clear()``.
"""
self._data.clear()

def __eq__(self, other):
if self is other:
return True
Expand Down Expand Up @@ -712,6 +706,12 @@ def popitem(self, *, type=None):
value = self.pop(key, type=type)
return key, value

def clear(self):
"""
Like ``dict.clear()``.
"""
self._data.clear()

def keys(self):
"""
Like ``dict.keys()``; returns a dictionary view.
Expand Down Expand Up @@ -1041,6 +1041,12 @@ def remove(self, value, *, type=None):
except ValueError:
raise ValueError("{!r} is not in list".format(value)) from None

def clear(self):
"""
Like ``list.clear()``.
"""
self._data.clear()

def reverse(self):
"""
Like ``list.reverse()``.
Expand Down

0 comments on commit f3088c6

Please sign in to comment.