Python: Retrieve Function Name Without Execution

  • Context: Python 
  • Thread starter Thread starter zeion
  • Start date Start date
  • Tags Tags
    Minor Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 1K views
zeion
Messages
455
Reaction score
1

Homework Statement



Hi there,

I just have a quick one here..
Is there a way to bring the NAME of a function? Not execute it?

Like if I had

def apple():
return

Can I get it to print "apple" somehow?
Thanks

Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
Nevermind I found the answer.
In case anyone else is curious you can do

print <function>.func_name