What does * mean in the following code (found in the pprint library)?
def pformat(object, indent=1, width=80, depth=None, *, compact=False): """Format a Python object into a pretty-printed representation.""" return PrettyPrinter(indent=indent, width=width, depth=depth, compact=compact).pformat(object)
If it was *args , then this would be an arbitrary number of positional parameters. The parameter values will be in a tuple called args . The first 4 parameters can be assigned either by name or by position, the compact parameter can be assigned only by name ...
Well no! Because he does not agree with the documentation :
In a function call, the keyword arguments must follow the positional arguments.
So what does a star do after and before other named arguments? And how is it used? Or why is he there if he is not used?
python syntax parameter-passing
stenci
source share