positional arguments python code example

Example: python positional argument

A function definition may look like:

def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
      -----------    ----------     ----------
        |             |                  |
        |        Positional or keyword   |
        |                                - Keyword only
         -- Positional only

where / and * are optional.
If used, these symbols indicate the kind of parameter by how
the arguments may be passed to the function:
      positional-only, positional-or-keyword, and keyword-only.
Keyword parameters are also referred to as named parameters.