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 |
What is __ init__ in python?
Explain me five benefits of using python?
Which is better perl or python?
what is random module will do in python and what are the functions we can apply on random module
Where is freeze for windows?
What is __ new __ in python?
What are the generators in python?
What is lambda in Python?
Write a code to display the current time.
What is the directory in python?
What is flask-wtf and what are their features?
How does Python handle the memory management?