def _sliced_list(self, selector):
"""For slice selectors operating on lists, we need to handle them
differently, depending on ``skipmissing``. In explicit mode, we may have
to expand the list with ``default`` values.
"""
if self.skipmissing:
return self.obj[selector]
# TODO: can be optimized by observing list bounds
keys = xrange(selector.start or 0,
selector.stop or sys.maxint,
selector.step or 1)
res = []
for key in keys:
self._append(self.obj, key, res, skipmissing=False)
return res
评论列表
文章目录