Issue
For example:
def f2(**kwargs):
b = kwargs.get('b',2)
print(b)
def f():
f2(c=2)
f()
What can I do to show an error when I put this c
as an argument and only allow the variables with name b
(what the function is expecting).
Solution
kwargs
is given as a dictionary. You can validate in any way you want.
def f2(**kwargs):
assert "c" not in kwargs
b = kwargs.get('b',2)
print(b)
def f():
f2(c=2)
f()
Answered By - Kota Mori
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.