How can we pass optional or keyword parameters from one function to another in Python?
Answer / chaitanya
Gather the arguments using the * and ** specifiers in the function's parameter list. This gives us positional arguments as a tuple and the keyword arguments as a dictionary. Then we can pass these arguments while calling another function by using * and **:
def fun1(a, *tup, **keywordArg):
...
keywordArg['width']='23.3c'
...
Fun2(a, *tup, **keywordArg)
| Is This Answer Correct ? | 0 Yes | 0 No |
How is “self” explicitly defined in a method?
Is there a tool to help find bugs or perform static analysis?
What is python list function?
Is there polymorphism in python?
Who created the Python programming language?
Tell me how does python handle the memory management?
Is r easier than python?
Why is that none of my threads are not running? How can I make it work?
What is the length of your largest python code? Can you please describe the project?
What is pass in Python?
Which gui is best for python?
What does super () do python?