Skip to content

The glossary of parameter should also explain required parameter and optional parameter in addition to the 5 parameters #137785

@hyperkai

Description

@hyperkai

I find there are 2 kinds of parameters as shown below:

  • The required parameter like p1 which must get an argument from a function call because it doesn't have a default value.
  • The optional parameter like p2, *args or **kwargs which optionally gets an argument from a function call because it has a default value.
def func(p1, p2='World'):
    print(p1, p2)

func(p1='Hello')
# Hello World
def func(*args, **kwargs):
    print(args, kwargs)

func()
# () {}

So, the glossary of parameter should also explain required parameter and optional parameter in addition to the 5 parameters as shown below:

... There are seven kinds of parameter:

  • positional-or-keyword: ...
  • positional-only: ...
  • keyword-only: ...
  • var-positional: ...
  • var-keyword: ...
  • required: ...
  • optional: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions