In Python 3.5, you can check the __text_signature__ inline function:
>>> eval.__text_signature__ '($module, source, globals=None, locals=None, /)'
or
>>> abs.__text_signature__ '($module, x, /)' >>> abs(x=5) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: abs() takes no keyword arguments
( x cannot be used as a keyword argument)
/ means that the following arguments can be used as keyword arguments. CF
>>> compile.__text_signature__ '($module, /, source, filename, mode, flags=0,\n dont_inherit=False, optimize=-1)' >>> compile(source='foo', filename='bar', mode='exec') <code object <module> at 0x7f41c58f0030, file "bar", line 1>
Of course, there are errors even in 3.5:
>>> sorted.__text_signature__ '($module, iterable, key=None, reverse=False)'
although according to issue 26729 in the Python tracker , after iterable should be / as iterable it cannot be used as a keyword argument.
Unfortunately, this information is not yet available in the Python documentation itself.