• I always forget how to access information about classes and methods - how to do it?

    From Chris Green@[email protected] to comp.lang.python on Mon Mar 9 16:27:02 2026
    From Newsgroup: comp.lang.python

    I know one can access information about python3 classes and methods
    (e.g. list the methods in a class, show the parameters for a method,
    etc.) but I always forget how to do it.

    Can someone enlighten me please, plus tell me where it is documented
    so that I can bookmark it and not need to ask again.
    --
    Chris Green
    ·
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From John Bokma@[email protected] to comp.lang.python on Mon Mar 9 17:52:05 2026
    From Newsgroup: comp.lang.python

    On 09/03/2026 17:27, Chris Green wrote:
    I know one can access information about python3 classes and methods
    (e.g. list the methods in a class, show the parameters for a method,
    etc.) but I always forget how to do it.

    Can someone enlighten me please, plus tell me where it is documented
    so that I can bookmark it and not need to ask again.

    inspect? https://docs.python.org/3/library/inspect.html
    --
    Static tumblelog generator: https://github.com/john-bokma/tumblelog/
    Available as Python or Perl. Example tumblelog: https://plurrrr.com/
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From ram@[email protected] (Stefan Ram) to comp.lang.python on Mon Mar 9 19:21:50 2026
    From Newsgroup: comp.lang.python

    Chris Green <[email protected]> wrote or quoted:
    I know one can access information about python3 classes and methods
    (e.g. list the methods in a class, show the parameters for a method,
    etc.) but I always forget how to do it.

    You can say (in the interactive console), with "int" as an
    example of a class and "to_bytes" as an example of a method
    (each line is a separate input):

    int
    int.to_bytes
    (1).to_bytes.__qualname__
    type( int )
    type( int.to_bytes )
    type( 1 )
    type( (1).to_bytes )
    dir( int )
    dir( int.to_bytes )
    help( int )
    help( int.to_bytes )
    help( 1 )
    help( (1).to_bytes )
    help() # and then later "quit" to quit help mode

    . Some IDEs give information or help about functions etc.
    after pressing some key, like Ctrl-Space or something.

    On Windows, the program group "Python" often has entries
    "Python 3.14 Manuals" and "Python 3.14 Module Docs".

    You can also find the Manuals in the Web as Web pages;
    I prefer the PDF manuals, but these now have been discontinued.

    You can ask any AI chatbot, "Tell me about the Python class int!",
    "What's the Web address of the Python documentation!" etc.


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@[email protected] to comp.lang.python on Mon Mar 9 20:25:41 2026
    From Newsgroup: comp.lang.python

    On Mon, 9 Mar 2026 16:27:02 +0000, Chris Green wrote:

    I know one can access information about python3 classes and methods
    (e.g. list the methods in a class, show the parameters for a method,
    etc.) but I always forget how to do it.

    The “help()” function?

    <https://docs.python.org/3/library/functions.html#help>
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Chris Green@[email protected] to comp.lang.python on Mon Mar 9 21:26:22 2026
    From Newsgroup: comp.lang.python

    Lawrence D’Oliveiro <[email protected]d> wrote:
    On Mon, 9 Mar 2026 16:27:02 +0000, Chris Green wrote:

    I know one can access information about python3 classes and methods
    (e.g. list the methods in a class, show the parameters for a method,
    etc.) but I always forget how to do it.

    The “help()” function?

    <https://docs.python.org/3/library/functions.html#help>

    Yes, that's it!! Thank you (and I've bookmarked that link, thank you
    som more)
    --
    Chris Green
    ·
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@[email protected] to comp.lang.python on Mon Mar 9 23:12:07 2026
    From Newsgroup: comp.lang.python

    On Mon, 9 Mar 2026 21:26:22 +0000, Chris Green wrote:

    ... and I've bookmarked that link ...

    I refer to <https://docs.python.org/3/library/> so often that I don’t
    even need to bookmark it: it’s in my browser’s autocomplete.
    --- Synchronet 3.21d-Linux NewsLink 1.2