Skip to content

Commit

Permalink
Improved clear() by removing provisions from Python 2 for no clear()
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed Feb 27, 2023
1 parent 69881d2 commit 8e81670
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions nocaselist/_nocaselist.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,8 @@ def clear(self):
"""
Remove all items from the list (and return None).
"""
try:
super(NocaseList, self).clear()
self._casefolded_list.clear()
except AttributeError:
del self[:]
del self._casefolded_list[:]
super(NocaseList, self).clear()
self._casefolded_list.clear()

def index(self, value, start=0, stop=9223372036854775807):
"""
Expand Down

0 comments on commit 8e81670

Please sign in to comment.