inspecting a callable for the arguments it accepts

Chris Angelico rosuav at gmail.com
Tue Nov 14 19:20:55 EST 2017


On Wed, Nov 15, 2017 at 9:03 AM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Cameron Simpson <cs at cskk.id.au> writes:
>>I would like to inspect submitted functions' signatures for suitability at
>>submission time, without calling the function. For example to see if this
>>function accepts exactly one argument, or to see if it is a generator, etc.
>
>   Sometimes, there is a __text__signature__:
>
> |>>> cos.__text_signature__
> |'($module, x, /)'
>
>   , but not always.

True. However, I'm pretty sure that applies only to Argument Clinic
functions, which are all implemented in C; the context suggests that
the functions in question will all be implemented in Python.

ChrisA



More information about the Python-list mailing list