0
parameter name which act a varible &which isn't string then why there is conflict between parameter name & 'name' in block ?
Finally, consider this function definition which has a potential collision between the positional argument name and **kwds which has name as a key: def foo(name, **kwds): return 'name' in kwds There is no possible call that will make it return True as the keyword 'name' will always to bind to the first parameter. For example: >>> foo(1, **{'name': 2}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got multiple values for argument 'name' >>>
3 Antworten
+ 1
# this one will return True:
def foo(**kwds):
return 'name' in kwds
print(foo(**{'name': 2})
)
0
+*********22
0
Thiên Khắc what's this ? "+*********22"