• What does this "See help(type(self)) for accurate signature." actually

    From Chris Green@3:633/10 to All on Sun Mar 15 09:05:08 2026
    Subject: What does this "See help(type(self)) for accurate signature." actually mean?

    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"?

    (Yes, I know it's a private[ish] method but this is just the first
    example I could find)


    --
    Chris Green
    ú

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Sun Mar 15 21:21:58 2026
    Subject: Re: What does this "See help(type(self)) for accurate signature." actually mean?

    On Sun, 15 Mar 2026 09:05:08 +0000, Chris Green 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"?

    Actually, you?ve got it right there. When you call the class to create
    an instance, you are actually calling the __init__ method (or the
    __new__ method, if that?s defined). So the arguments you need to pass
    are exactly those accepted by that method. No need to look anywhere
    else for the ?accurate signature?, since you have just posted it.

    Or it just means that the detailed docstring explaining what all those
    args are for is attached to the class, not this __init__ method.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chris Green@3:633/10 to All on Mon Mar 16 08:53:29 2026
    Subject: Re: What does this "See help(type(self)) for accurate signature." actually mean?

    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:
    On Sun, 15 Mar 2026 09:05:08 +0000, Chris Green 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"?

    Actually, you?ve got it right there. When you call the class to create
    an instance, you are actually calling the __init__ method (or the
    __new__ method, if that?s defined). So the arguments you need to pass
    are exactly those accepted by that method. No need to look anywhere
    else for the ?accurate signature?, since you have just posted it.

    Or it just means that the detailed docstring explaining what all those
    args are for is attached to the class, not this __init__ method.

    Yes, I realise that the __init__ method shows the signature. In that
    case what does that "See help(type(self)) for accurate signature" mean
    then? I was hoping it might provide some more detail somewhere/somehow.

    The same phrase occurs in other places, I'll see if any aren't like
    this one where the arguments are there anyway.

    --
    Chris Green
    ú

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Mon Mar 16 09:15:28 2026
    Subject: Re: What does this "See help(type(self)) for accurate signature." actually mean?

    On Mon, 16 Mar 2026 08:53:29 +0000, Chris Green wrote:

    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:

    On Sun, 15 Mar 2026 09:05:08 +0000, Chris Green wrote:

    In that case what does that "See help(type(self)) for accurate
    signature" mean then?

    Or it just means that the detailed docstring explaining what all
    those args are for is attached to the class, not this __init__
    method.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jon Ribbens@3:633/10 to All on Mon Mar 16 10:17:53 2026
    Subject: Re: What does this "See help(type(self)) for accurate signature." actually mean?

    On 2026-03-15, Chris Green <cl@isbd.net> 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.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jon Ribbens@3:633/10 to All on Mon Mar 16 17:01:51 2026
    Subject: Re: What does this "See help(type(self)) for accurate signature." actually mean?

    On 2026-03-16, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
    Jon Ribbens <jon+usenet@unequivocal.eu> wrote or quoted:
    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.

    |Python 3.14

    import types

    self = types.SimpleNamespace()

    self.__doc__ = "my custom doc"

    help(self)
    |Help on SimpleNamespace:
    |namespace(__doc__='my custom doc')
    | my custom doc

    help(type(self))
    |Help on class SimpleNamespace in module types:
    |class SimpleNamespace(builtins.object)
    | | SimpleNamespace(mapping_or_iterable=(), /, **kwargs)
    | | A simple attribute-based namespace.
    | | Methods defined here:
    . . .

    Ok, but does anyone ever set __doc__ on instances?
    That's a pretty weird thing to do.

    the class itself doesn't have
    a docstring either. So there is nothing to display no matter what
    you type.

    Even without docstrings, info about names, parameters etc. is shown.

    Yes, everyone can see that from what OP has already posted here.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)