人类总监
see的Python项目详细描述
see是python 2.6+和3.3+的dir()的替代品。
它简洁地总结了你可以用一个物体做什么。 使用它检查代码或学习新的api。
Example
假设您有一个想要了解更多信息的对象:
>>> from datetime import timedelta
尝试使用see:
检查对象>>> see(timedelta) isclass + - * / // % +obj -obj < <= == != > >= abs() bool() dir() divmod() hash() help() repr() str() .days .max .microseconds .min .resolution .seconds .total_seconds()
在这里我们可以发现一些关于它的事情,例如:
- 对象是类。
- 您可以使用+运算符向其添加一些内容。
- 它有一个seconds属性。
- 它有一个total_seconds属性,它是一个函数。
与dir的输出比较:
>>> dir(timedelta) ['__abs__', '__add__', '__bool__', '__class__', '__delattr__', ' __dir__', '__divmod__', '__doc__', '__eq__', '__floordiv__', '__ format__', '__ge__', '__getattribute__', '__gt__', '__hash__', ' __init__', '__init_subclass__', '__le__', '__lt__', '__mod__', ' __mul__', '__ne__', '__neg__', '__new__', '__pos__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rf loordiv__', '__rmod__', '__rmul__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclassho ok__', '__truediv__', 'days', 'max', 'microseconds', 'min', 'res olution', 'seconds', 'total_seconds']
可以使用通配符模式筛选see的结果 或正则表达式:
>>> see(timedelta).filter('*sec*') .microseconds .seconds .total_seconds() >>> see(timedelta).filter('/^d/') dir() divmod()