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]
评论列表
文章目录