__init__.py 文件源码

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

项目:midict 作者: ShenggaoZhu 项目源码 文件源码
def __repr__(self, _repr_running={}):
        'repr as "MIDict(items, names)"'
        call_key = id(self), _get_ident()
        if call_key in _repr_running: # pragma: no cover
            return '<%s(...)>' % self.__class__.__name__
        _repr_running[call_key] = 1
        try:
            try:
                if self.indices:
                    names = force_list(self.indices.keys())
                    items = force_list(self.items())
                    return '%s(%s, %s)' % (self.__class__.__name__, items, names)
            except AttributeError: # pragma: no cover
                # may not have attr ``indices`` yet
                pass
            return '%s()' % self.__class__.__name__
        finally:
            del _repr_running[call_key]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号