[Python-Dev] Updated PEP 362 (Function Signature Object)

Steven D'Aprano steve at pearwood.info
Thu Jun 7 00:27:29 CEST 2012


Larry Hastings wrote:

>> inspect.getfullargspec is currently unable to introspect builtin 
>> functions and methods. Should builtins gain a __signature__ so they 
>> can be introspected?
> 
> If function signatures are useful, then they're useful, and the 
> implementation language for the function is irrelevant.  I already sent 
> Yuri a patch adding __signature__ to PyCFunctionObject, which I thought 
> he merged but I don't see in his repo.

I would love to be able to inspect builtins for their signature. I have a 
class decorator that needs to know the signature of the class constructor, 
which unfortunately falls down for the simple cases of inheriting from a 
builtin without a custom __init__ or __new__.


-- 
Steven



More information about the Python-Dev mailing list