[Python-3000] callable()

Baptiste Carvello baptiste13 at altern.org
Mon Jul 17 20:07:39 CEST 2006


> If 'callable' is to stay, then in order to pull its weight it needs to
> grow to provide a way to check "callable with the following signature"
> -- at the very least in terms of numbers and names of arguments,
> though (if py3k does gain some syntax for specifying argument types)
> it might do more.  E.g., just "callable(fun)" should mean "fun appears
> to be callable without arguments, e.g. I believe that doing 'fun()'
> will not result in a TypeError from the call operation itself", while
> "callable(fun, int, zap=list[int])" should mean "fun appears to be
> callable with one positional argument that's an int and an argument
> named zap that is a list of ints", i.e. the apparently-acceptable call
> is of some form such as "fun(23, [4, 5])" [[presumably using object as
> a placeholder for unchecked-types]] -- so that for example a
> 
+1 on the concept.
If it doesn't go in __builtin__, maybe it can go somewhere in the stdlib so that 
people don't have to reimplement it badly.

BC



More information about the Python-3000 mailing list