What does a single * without identifier mean in the Python3 functions?

function, python, python-3.x

Solution

The lone `*` indicates that all following arguments are keyword-only arguments, that is, they can only be provided using their name, not as positional argument.

See PEP 3102 for further details.

Problem

What does a single * without identifier mean in the Python function arguments? Here is an example that works with Python3.2: ``` class Shape: def __init__(self, *, shapename, **kwds): self.shapename = shapename super().__init__(**kwds) ``` For me the star after the self is strange. I have found it here (from row 46): http://code.activestate.com/recipes/577720-how-to-use-super-effectively/ UPDATE: Later also / was added to the argument list of Python functions. You might want to understand them in pair.

Original source

Related problems