Checking function calls

Roy Smith roy at panix.com
Tue Mar 7 08:19:29 EST 2006


Fredrik Tolf  <python-list at python.org> wrote:
>If I have a variable which points to a function, can I check if certain
>argument list matches what the function wants before or when calling it?
>
>Currently, I'm trying to catch a TypeError when calling the function
>(since that is what is raised when trying to call it with an illegal
>list), but that has the rather undesirable side effect of also catching
>any TypeErrors raised inside the function. Is there a way to avoid that?

The only way is to read the documentation for the function (or, the
source code).

Can you be a little more specific about what you're trying to do?  Can
you post your code?



More information about the Python-list mailing list