What function parameters does Python have?
This article introduces the relevant knowledge of "what function parameters does Python have". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Function parameter matching table syntax position interpretation func (value) caller general parameters: match func (name=value) caller keyword parameters: match func (* sequence) caller by variable name pass all objects in name, and as independent location-based parameters func (* * dict) callers pass all keywords / values in name pairs And as an independent keyword parameter def func (name) function general parameter: match the default parameter value of the def func (name=value) function by position or variable name If not passed in the call, the def func (* name) function matches and collects (in tuples) all parameters containing position def func (* * name) function matches and collects (in the dictionary) all parameters containing position def func (* args, name) function parameters must be passed in the call by keyword def func (*, name=value) function Python 3.0II, parameter order
In a function call, parameters must appear in this order: any unknown parameter (value), followed by any keyword argument (name=value) and * sequence form combination, followed by * * dict form
At the head of the function, the parameters must appear in this order: any general parameter (name), followed by any default parameter (name=value), if any, followed by * name (or * in Python 3.0), followed by any name or name=value keyword-only parameter (in Python 3.0), followed by * * name.
This is the end of the content of "what function parameters does Python have". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!