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 |
Are Tuples immutable?
What does the map() function do?
What does end do in python?
Which is better Python or ruby?
Can you count to zero?
What is a pil in python?
What is difference between range and arange function in python?
Why do we need tuples?
How do I kill a python server?
Is python a low level language?
What is the use of numpy package?
What is python __ init __?