








1 def info(object, spacing=10, collapse=True):
2 """Print methods and doc strings.
3
4 Takes module, class, list, dictionary, or string."""
5 methodList = [method for method in dir(object) if callable(getattr(object, method))]
6 processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s)
7 print "\n".join(["%s %s" %
8 (method.ljust(spacing),
9 processFunc(str(getattr(object, method).__doc__)))
10 for method in methodList])
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。