[Tutor] Argument check

Kent Johnson kent37 at tds.net
Thu May 4 19:40:24 CEST 2006


Gregor Lingl wrote:
> Hi all,
> 
> I've a class with a lot of methods, for which I'd like to check argument types. 

You're not the first person to want to do this. You might be interested 
in these:
http://www.artima.com/weblogs/viewpost.jsp?thread=155123
http://www.python.org/dev/peps/pep-0246/

including the references in both cases.

> but then chackargs had to get information about its caller (name, locals) from 
> elsewhere (the callstack?). I don't know if this is possible at all, not to say 
> how to accomplish it.

See this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062

Kent



More information about the Tutor mailing list