Reputation: 109
Please bear with me! I'm used to programming in C and I just started learning python.
I have a main function and a stub function as follows:
def main_function(string):
print(string)
def stub_function():
return 'some random string'
I want to pass in my stub_function into my main_function and ideally be able to print out 'some random string'.
main_function(stub_function)
But I keep getting:
<function stub_function at 0x7f21f07e0d08>
I've tried searching but I can't seem to find anything that I can understand. What is going on here and how can I fix it? Thanks in advance!
Upvotes: 1
Views: 135
Reputation: 286
You must call the function for it to return the value.
main_function(stub_function())
Upvotes: 1