def named_refs(obj, **opts):
"""Returns (a generator for) all named *referents* of an object
(re-using functionality from **asizeof**).
See function **basicsize** for a description of the options.
Does not return un-named *referents*, e.g. objects in a list.
"""
t = _typedefof(obj, **opts)
if t:
r = t.refs
if r and _iscallable(r):
for nr in r(obj, True):
try:
yield nr.name, nr.ref
except AttributeError:
pass
评论列表
文章目录