Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Understanding "help()" output?
I am fairly new to Python and sometimes have minor trouble understanding the output from help().

First of all, is there a way to tell what formats are acceptable for *args and **kwargs? When the help() function lists methods, it often gives something like:
Methods defined here:
__method__(self, / ,*args,**kwargs).

I would like to play around and experiment with different modules and methods, but often find it difficult because I can't figure out what formats to use for *args and **kwargs. I also assume that this display fails to communicate the number of arguments that are required as well.
*args means that the function or method accepts any number of unnamed parameters. The parameters themselves are just expressions or values, and they are separated by commas. **kwargs means that the function or method accepts any number of named parameters, which are a name, and equals sign, and an expression or value. Again, they are separated by commas.
metulburr likes this post
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Not sure this will help, but:

I wrote a package not long after I started programming in python (this is a warning)
called PyHarry, available here:
in that, there is a module named (
In that module, there is a method named 'inspect_getHelp' you might find this useful. I believe the intent was
to get all of the help, but you perhaps can scrape some of what's there.
So for example, when I type (help(bytes)) and receive:

bytes(string, encoding [,errors]) --> errors ,

Does this command take 2 arguments or 3? The bracket notation with the errors confuses me, partly because the comma is inside the bracket. Also, how can I know what types of arguments are acceptable for the encoding?
The brackets do indicate that that parameter is optional.  bytes, in particular, has a huge amount of docs, and if you go down further, you can see what it expects the encoding to be...
 |  decode(self, /, encoding='utf-8', errors='strict')
 |      Decode the bytes using the codec registered for encoding.
 |      encoding
 |        The encoding with which to decode the bytes.
 |      errors
 |        The error handling scheme to use for the handling of decoding errors.
 |        The default is 'strict' meaning that decoding errors raise a
 |        UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
 |        as well as any other name registered with codecs.register_error that
 |        can handle UnicodeDecodeErrors.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  understanding output of bytes/raw data rootVIII 3 422 Aug-01-2019, 01:00 PM
Last Post: rootVIII
  help on understanding this output landlord1984 1 1,097 Mar-08-2017, 08:29 PM
Last Post: zivoni

Forum Jump:

Users browsing this thread: 1 Guest(s)