◐ Shell
clean mode source ↗

operator.{itemgetter,attrgetter,methodcaller} don't have signatures

Feature or enhancement

Update the docstrings to operator.itemgetter, operator.attrgetter, and operator.methodcaller so that they will automatically be given __text_signature__ strings so inspect.signature will give correct signature.

Pitch

These are the only functions in operator that don't have signatures. operator functions are often used when programming in a functional style, and sometimes signature inspection is useful to e.g. determine whether a call is valid or whether to curry arguments.

Also, as a user, I find it nice to see accurate text signatures in the docstring and when calling help(func).

Previous discussion

These were intentionally skipped when operator functions were updated to use the argument clinic. See:

PR forthcoming.