mirror of
https://github.com/python/cpython.git
synced 2024-11-30 21:34:17 +08:00
Issue #11388: Added a clear() method to MutableSequence
This commit is contained in:
parent
1bc4f193d8
commit
9479d1ade8
@ -596,6 +596,13 @@ class MutableSequence(Sequence):
|
||||
def append(self, value):
|
||||
self.insert(len(self), value)
|
||||
|
||||
def clear(self):
|
||||
try:
|
||||
while True:
|
||||
self.pop()
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
def reverse(self):
|
||||
n = len(self)
|
||||
for i in range(n//2):
|
||||
|
Loading…
Reference in New Issue
Block a user