python 3.x - Passing a function as two parameters -


so have function takes 2 parameters , function returns 2 parameters. can't seem figure out how this. in order simplyfy code make funcions.

def my_function(x, y):     return x + y  def get_x_and_y():     x, y = [5, 10]     return x, y  print(my_function(get_x_and_y())) 

so gives error , i'm not sure how this.

i know might answered i'm not quite sure how word on google, , have looked while.

the answer question here: what ** (double star/asterisk) , * (star/asterisk) parameters?. suggested in everts comment:

print(my_function(*get_x_and_y())) 

where asterisk performs parameter expansion (also called splatting in ruby, love term :) )


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -