[rset] support for delitem on repeat list (may be necessary in pyro source) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 01 Oct 2010 11:08:31 +0200
branchstable
changeset 6374 5adf53edfe12
parent 6372 4c3e2a92e340
child 6375 df4fd2a1b0e7
[rset] support for delitem on repeat list (may be necessary in pyro source)
utils.py
--- a/utils.py	Fri Oct 01 09:25:39 2010 +0200
+++ b/utils.py	Fri Oct 01 11:08:31 2010 +0200
@@ -131,6 +131,9 @@
         return repeat(self._item, self._size)
     def __getitem__(self, index):
         return self._item
+    def __delitem__(self, idc):
+        assert self._size > 0
+        self._size -= 1
     def __getslice__(self, i, j):
         # XXX could be more efficient, but do we bother?
         return ([self._item] * self._size)[i:j]