FIX: Problem with function call assignment order
01, usually one by one corresponding assignment (with predefined values can not be assigned value)-------recommended ******
02, parameter one by one assignment can be specified
03, a parameter with a predefined value cannot take precedence over a parameter that has no pre-defined value assigned
Note: 01 in the case of a call, do not write the parameter name.
02 in the case of a call, specify: Parameter name = value (all the visible parameters are indicated)
EG1:
def test_e (n1,n2,n3=15):
N=n1+n2+n3
return n
01 corresponding Calling Method: S=test_e (4,1) n3=15
S=test_e (4,1,12) n3=12
02 corresponding Calling Method: S=test_e (4,n2=1) n3=15
S=test_e (4,n2=1,n3=12)
S=test_e (n2=1,n1=4) n3=15
03 corresponding Call Method: S=test_e (n3=14,n2=1,n1=4)----OK
S=test_e (n3=14,n2=1,4)--------No
S=test_e (n3=14,1,4)-----------No
Reason for two No in 03: parameters that have predefined values cannot be assigned precedence over parameters that do not have predefined values.
S=test_e (4,n1=1)--------------No
Cause: 4 is assigned to N1 by default, N1 cannot be assigned repeatedly
S=test_e (4,1,n3=15)-----------OK
Tenth Python function argument assignment order