Return function name in python?

function, python

Solution

You can use:

integral.func_name

Or:

integral.__name__

Though, they are exactly equivalent. According to docs:

`__name__` is Another way of spelling func_name

Here's a sample code:

>>> def f():
    pass

>>> f.__name__
'f'
>>> f.func_name
'f'
>>> 

Problem

Doing a math function of the type `def`. ``` def integral_error(integral,f): ------stufff------- print integral ``` gives something like: `'<function simpsons at 0xb7370a74>'` is there a way to get just simpsons without string manipulations? ie just the function name?

Original source

Related problems