Chris Angelico wrote:
That will give you some idea, but it's not foolproof -- e.g.
if the function has * or ** arguments, it's impossible to tell
in general how many arguments it accepts without studying the
code (and maybe not even then -- halting problem, etc.)
Some of the co_flags seem to indicate presence of * and **:
0x04 - has *args
0x08 - has **kwds
In Py3 there is also co_kwonlyargcount.