Let\'s suppose we have a function like this:
def myFunction(arg1=\'a default value\'):
pass
We can use introspection to find out the name
If you define a function f
like this:
>>> def f(a=1, b=True, c="foo"):
... pass
...
in Python 2, you can use:
>>> f.func_defaults
(1, True, 'foo')
>>> help(f)
Help on function f in module __main__:
f(a=1, b=True, c='foo')
whereas in Python 3, it's:
>>> f.__defaults__
(1, True, 'foo')
>>> help(f)
Help on function f in module __main__:
f(a=1, b=True, c='foo')