dicts.py 文件源码

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

项目:fandango 作者: tango-controls 项目源码 文件源码
def sort(self,key):
        """
        This method modifies the sorting of the dictionary overriding the existing sort key.
        :param key: it can be a sequence containing all the keys already existing in the dictionary 
                    or a callable providing a sorting key algorithm.
        """
        import operator
        if operator.isCallable(key):
            self._keys = sorted(self._keys,key=key)
        else:
            for k in self._keys:
                if k not in self._keys: raise KeyError(k)
            self._keys = list(key)
        return self._keys[:]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号