Python Forum

Full Version: Extra Argument In Help Response
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using IDLE with Python 3.7.3 in Windows. When requesting help for some built-in functions (e.g. get and setdefault) I'm getting back documentation that appears to indicate there is 1 more argument than the functions actually support. Here are some responses from IDLE. I tried from a Windows command prompt and see the same thing.

>>> help({}.get)
Help on built-in function get:

get(key, default=None, /) method of builtins.dict instance
    Return the value for key if key is in the dictionary, else default.

>>> help({}.setdefault)
Help on built-in function setdefault:

setdefault(key, default=None, /) method of builtins.dict instance
    Insert key with a value of default if key is not in the dictionary.
    
    Return the value for key if key is in the dictionary, else default.
Why is there what appears to be an extra argument (", /") at the end of the list? What's the purpose of the ", /" at the end? Is it a bug in the documentation?

Thanks for any explanations you can provide.
The / indicates that the args before it are positional-only, they can not be passed as keyword arguments.
Thanks for the answer. Based on your answer, I was able to locate PEP 570 -- Python Positional-Only Parameters. This PEP provides some additional history and other information on the topic.