mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added __delitem__ (untested, though)
This commit is contained in:
parent
f40780156e
commit
66497f1f4e
@ -237,7 +237,21 @@ class queue(object):
|
||||
if len(self.front) > idx:
|
||||
self.front[-(idx+1)] = value
|
||||
else:
|
||||
self.back[(idx-len(self.front))] = value
|
||||
self.back[idx-len(self.front)] = value
|
||||
|
||||
def __delitem__(self, oidx):
|
||||
if type(oidx) == types.SliceType:
|
||||
range = xrange(*sliceIndices(oidx, len(self)))
|
||||
for i in range:
|
||||
del self[i]
|
||||
else:
|
||||
(m, idx) = divmod(oidx, len(self))
|
||||
if m and m != -1:
|
||||
raise IndexError, oidx
|
||||
if len(self.front) > idx:
|
||||
del self.front[-(idx+1)]
|
||||
else:
|
||||
del self.back[idx-len(self.front)]
|
||||
|
||||
def __getstate__(self):
|
||||
return (list(self),)
|
||||
|
Loading…
Reference in New Issue
Block a user