Commit 9479d1ad authored by Eli Bendersky's avatar Eli Bendersky

Issue #11388: Added a clear() method to MutableSequence

parent 1bc4f193
...@@ -596,6 +596,13 @@ class MutableSequence(Sequence): ...@@ -596,6 +596,13 @@ class MutableSequence(Sequence):
def append(self, value): def append(self, value):
self.insert(len(self), value) self.insert(len(self), value)
def clear(self):
try:
while True:
self.pop()
except IndexError:
pass
def reverse(self): def reverse(self):
n = len(self) n = len(self)
for i in range(n//2): for i in range(n//2):
......
...@@ -140,6 +140,8 @@ Library ...@@ -140,6 +140,8 @@ Library
- Issue #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers - Issue #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers
larger than 4GB. Patch by Nadeem Vawda. larger than 4GB. Patch by Nadeem Vawda.
- Issue #11388: Added a clear() method to MutableSequence
Build Build
----- -----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment