0

how to call a function from a function object

a = fun_name
print(a)

like from this function object that I get how can I call the original function only from using this function object

<function fun_name at 0x00000265C9B0E320>

2 Answers 2

2

You just call the object, since it's just a function object, not really but it refers to it, example:

def a():

    return 'a'

b = a
print(b())
Sign up to request clarification or add additional context in comments.

4 Comments

actually I'm storing this in a dictionary
dct = {"func": func}
now i want dct["func"] to call the function func but it's giving me a function object can i call that object to call my original function
Just do this: dct['func']()
1

You can call the original function like a() in this case.

1 Comment

thanks, it was simple though but still, I wasn't able to figure it out !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.