On 2026-03-15, Chris Green <[email protected]> wrote:
> I see this message in several places in the help() output for gpiod:
> "See help(type(self)) for accurate signature.", but I can't work out
> what I actually need to type into help() to get a result.
>
> So, for example, I say 'help("gpiod.line_settings")', I see, among
> other things:-
>
> | __init__(
> | self,
> | direction: gpiod.line.Direction = <Direction.AS_IS: 1>,
> | edge_detection: gpiod.line.Edge = <Edge.NONE: 1>,
> | bias: gpiod.line.Bias = <Bias.AS_IS: 1>,
> | drive: gpiod.line.Drive = <Drive.PUSH_PULL: 1>,
> | active_low: bool = False,
> | debounce_period: datetime.timedelta = datetime.timedelta(0),
> | event_clock: gpiod.line.Clock = <Clock.MONOTONIC: 1>,
> | output_value: gpiod.line.Value = <Value.INACTIVE: 0>
> | ) -> None
> | Initialize self. See help(type(self)) for accurate signature.
>
> What do I actually need to type to get that "accurate signature"?
You need to type: help("gpiod.line_settings")
The thing it's referring to was already displayed further up in the
"other things" you mention, after the line:
class LineSettings(builtins.object)
The text you're asking about comes from here:
>>> object.__init__.__doc__
'Initialize self. See help(type(self)) for accurate signature.'
Since "object" is the automatic base class, when help() looks at
gpiod.line_settings.LineSettings.__init__ it sees no __doc__ to
display, and looks up the inheritance tree and finds and outputs
object.__init__.__doc__.
What help(type(self)) is talking about is to try and display the
__doc__ of the class itself rather than the class's __init__.
'self' isn't meant literally, it means "an object that is an
instance of this class". I don't know why it says "type(self)",
because help(foo) where 'foo' is an instance of a class 'xyz'
seems to display the same as help(xyz) anyway.
And regardless, it's all irrelevant in the case of your specific
example gpiod.line_settings.LineSettings because as well as
__init__ not having a docstring, the class itself doesn't have
a docstring either. So there is nothing to display no matter what
you type.
--
https://mail.python.org/mailman3//lists/python-list.python.org