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

How is “self” explicitly defined in a method?

1 Answers  


Is there a tool to help find bugs or perform static analysis?

0 Answers  


What is python list function?

0 Answers  


Is there polymorphism in python?

0 Answers  


Who created the Python programming language?

0 Answers  


Tell me how does python handle the memory management?

0 Answers  


Is r easier than python?

0 Answers  


Why is that none of my threads are not running? How can I make it work?

0 Answers  


What is the length of your largest python code? Can you please describe the project?

0 Answers  


What is pass in Python?

0 Answers  


Which gui is best for python?

0 Answers  


What does super () do python?

0 Answers  


Categories