Print the call signature for any callable object. If the object is a class, print the constructor information.
(self, obj, oname='')
| 458 | print() |
| 459 | |
| 460 | def pdef(self, obj, oname=''): |
| 461 | """Print the call signature for any callable object. |
| 462 | |
| 463 | If the object is a class, print the constructor information.""" |
| 464 | |
| 465 | if not callable(obj): |
| 466 | print('Object is not callable.') |
| 467 | return |
| 468 | |
| 469 | header = '' |
| 470 | |
| 471 | if inspect.isclass(obj): |
| 472 | header = self.__head('Class constructor information:\n') |
| 473 | |
| 474 | |
| 475 | output = self._getdef(obj,oname) |
| 476 | if output is None: |
| 477 | self.noinfo('definition header',oname) |
| 478 | else: |
| 479 | print(header,self.format(output), end=' ') |
| 480 | |
| 481 | # In Python 3, all classes are new-style, so they all have __init__. |
| 482 | @skip_doctest |