New submission from Serhiy Storchaka:
Pydoc outputs the text signature for C functions. It defines parameters and
default values and is a part of function description.
Help on built-in function format in module builtins:
format(value, format_spec='', /)
Return value.__format__(format_spec)
format_spec defaults to the empty string
When builtin or extension class is converted to Argument Clinic, the generated
docstring and text signature of __new__ or __init__ methods usually is used as
class docstring and text signature. But pydoc doesn't output the text signature
for classes. The important part of information is lost.
For example, for just converted builtin enumerate class:
Help on class enumerate in module builtins:
class enumerate(object)
| Return an enumerate object.
|
| iterable
| an object supporting iteration
|
| The enumerate object yields pairs containing a count (from start, which
| defaults to zero) and a value yielded by the iterable argument.
|
| enumerate is useful for obtaining an indexed list:
| (0, seq[0]), (1, seq[1]), (2, seq[2]), ...
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
The iterable and start parameters of the constructor are referred but not
defined.
----------
components: Argument Clinic, Library (Lib)
messages: 285946
nosy: larry, ncoghlan, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Output the text signature in the help of a class
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com