Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can we pass optional or keyword parameters from one function to another in Python?



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

Post New Answer

More Python Interview Questions

What is the difference between a list and a tuple?

0 Answers  


What good is recursion?

0 Answers  


What is xrange in python?

1 Answers  


is Python similar to ruby?

0 Answers  


What is pip software in the python world?

0 Answers  


How python supports encapsulation with respect to functions?

0 Answers  


Which database is used in python?

0 Answers  


Do you know what are the optional statements that can be used inside a <try-except> block in python?

0 Answers  


How can you access a module written in python from c?

0 Answers  


How can you access a session in flask?

0 Answers  


How do you find missing values in python?

0 Answers  


What does the map() function do?

0 Answers  


Categories