__init__.py 文件源码

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

项目:stig 作者: rndusr 项目源码 文件源码
def apply(self, items, inplace=False, item_getter=lambda item: item):
        """Sort sequence `items`

        item_getter: Callable that gets an item of `items` and returns an
                     object that can be sorted with any of the sorters
                     specified in the SORTSPECS variable. (This allows for
                     sorting of widgets as long as they can provide a sortable
                     object.)
        inplace: Modify `items` if True, otherwise return a new list
        """
        import time
        start_time = time.monotonic()

        for sorter in self._sortfuncs:
            items = sorter(items, inplace=inplace, item_getter=item_getter)

        log.debug('-> Sorted %d items by %s in %.3fms',
                  len(items), self, (time.monotonic()-start_time)*1e3)

        if not inplace:
            return items
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号