Search code examples
pythonpydoc

How to understand pydoc parameters in documentation


I was looking up seek() in pydoc file and found the explanation on what the function does, but I didn't understand how the documentation states the parameters. It looked like this:

seek(offset[, whence])

At first I thought it was a parameter in a parameter but it obviously isn't. What do those brackets denote in the parameter fields?


Solution

  • everything that is between [ and ] are optional

    in this case you can call:

    seek(offset)
    

    or

    seek(offset, whence)