about 'setattr(o, name, value)' and 'inspect.signature(f)'

Terry Reedy tjreedy at udel.edu
Tue Oct 10 12:06:52 EDT 2017


On 10/10/2017 10:37 AM, xieyuheng wrote:
> 2. what kind of functions does not have signature,
> so that 'inspect.signature(f)' can be used for them ?

When .signature was added, it may not have been usable with *any* 
C-coded function. About the same, a mechanism was added to make 
signatures available with C-coded functions. Using the mechanism 
requires recoding for each file. By now, many CPython functions have 
been recoded.
> section '29.12.3. Introspecting callables with the Signature object'
> of the official documentation says :
>> > Some callables may not be introspectable in certain implementations of Python.

So 'some' is a gradually shrinking set.
> > For example, in CPython, some built-in functions defined in C
> > provide no metadata about their arguments.
>> this is depends on implementation, so I ask for CPython.

-- 
Terry Jan Reedy


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /