structural.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:plucky 作者: randomir 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号