Suppose I have a function and I want to print out the arguments it accepts. How can I do this?
Use inspect.getargspec() to find out.
I see that someone has already offered the answer i had in mind, so i'll suggest a purely practical one. IDLE will give you a function's parameters as a 'tooltip'.
This should be enabled by default; the tooltip will appear just after you type the function name and the left parenthesis.
To do this, IDLE just accesses the function's doc string, so it will show the tooltip for any python function--standard library, third-party library, or even a function you've created earlier and is in a namespace accessible to IDLE.
Obviously, this is works only when you are working in interactive mode in IDLE, though it does have the advantage of not requiring an additional function call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With