mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Fixed bug in queue.__{get,set}item__.
This commit is contained in:
parent
a35bf21b4e
commit
b1a1c85a17
@ -208,6 +208,8 @@ class queue(object):
|
|||||||
return 'queue([%s])' % ', '.join(map(repr, self))
|
return 'queue([%s])' % ', '.join(map(repr, self))
|
||||||
|
|
||||||
def __getitem__(self, oidx):
|
def __getitem__(self, oidx):
|
||||||
|
if len(self) == 0:
|
||||||
|
raise IndexError, 'queue index out of range'
|
||||||
if type(oidx) == types.SliceType:
|
if type(oidx) == types.SliceType:
|
||||||
L = []
|
L = []
|
||||||
for i in xrange(*sliceIndices(oidx, len(self))):
|
for i in xrange(*sliceIndices(oidx, len(self))):
|
||||||
@ -223,6 +225,8 @@ class queue(object):
|
|||||||
return self.back[(idx-len(self.front))]
|
return self.back[(idx-len(self.front))]
|
||||||
|
|
||||||
def __setitem__(self, oidx, value):
|
def __setitem__(self, oidx, value):
|
||||||
|
if len(self) == 0:
|
||||||
|
raise IndexError, 'queue index out of range'
|
||||||
if type(oidx) == types.SliceType:
|
if type(oidx) == types.SliceType:
|
||||||
range = xrange(*sliceIndices(oidx, len(self)))
|
range = xrange(*sliceIndices(oidx, len(self)))
|
||||||
if len(range) != len(value):
|
if len(range) != len(value):
|
||||||
|
Loading…
Reference in New Issue
Block a user