Print the call signature for any callable object. If the object is a class, print the constructor information.
(self, obj, oname='')
| 394 | print() |
| 395 | |
| 396 | def pdef(self, obj, oname=''): |
| 397 | """Print the call signature for any callable object. |
| 398 | |
| 399 | If the object is a class, print the constructor information.""" |
| 400 | |
| 401 | if not callable(obj): |
| 402 | print('Object is not callable.') |
| 403 | return |
| 404 | |
| 405 | header = '' |
| 406 | |
| 407 | if inspect.isclass(obj): |
| 408 | header = self.__head('Class constructor information:\n') |
| 409 | |
| 410 | |
| 411 | output = self._getdef(obj,oname) |
| 412 | if output is None: |
| 413 | self.noinfo('definition header',oname) |
| 414 | else: |
| 415 | print(header,self.format(output), end=' ') |
| 416 | |
| 417 | # In Python 3, all classes are new-style, so they all have __init__. |
| 418 | @skip_doctest |