Python, * args and ** kwargs

* Args and ** kwargs in Python popular naming conventions for passing parameters of indefinite length.

Wherein, * args parameter can be passed a variable number of non-key-value pairs list to a function,

** kwargs pass a key type of a variable number of parameters to a dictionary function.

 

Standard parameters * args, * kwargs order when used require special attention to:

If now a function of the use of these three parameters, then the order of the three parameters should be: standard parameter, * args, ** kwargs.

 

Guess you like

Origin www.cnblogs.com/jiangkejie/p/11401401.html