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

xieyuheng xyheme at gmail.com
Tue Oct 10 10:37:29 EDT 2017


in CPython,

instead of trying each object and function,

is there any rules can help me answer the following questions ?

or is there any third part documentations
[community driven docs ? wiki ?]
that can answer them ?

1. 'setattr(o, name, value)' can be used for what kind of objects ?

   section '2. Built-in Functions'
   of the official documentation says :

   > The function assigns the value to the attribute, provided the object allows it.

2. what kind of functions does not have signature,
   so that 'inspect.signature(f)' can be used for them ?

   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.
   > 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.

------
xyh



More information about the Python-list mailing list