def pdef(self, obj, oname=''):
"""Print the call signature for any callable object.
If the object is a class, print the constructor information.
"""
if not callable(obj):
print('Object is not callable.')
return
header = ''
if inspect.isclass(obj):
header = self.__head('Class constructor information:\n')
obj = obj.__init__
elif (not ISPY3K) and type(obj) is types.InstanceType:
obj = obj.__call__
output = self._getdef(obj, oname)
if output is None:
self.noinfo('definition header', oname)
else:
print(header, output, end=' ', file=sys.stdout)
评论列表
文章目录