# An option for inspect.signature to hide "internal use" arguments?

**URL:** <https://discuss.python.org/t/an-option-for-inspect-signature-to-hide-internal-use-arguments/25543>\
**Category:** Ideas\
**Created:** [April 7, 2023, 4:52am UTC](https://discuss.python.org/t/an-option-for-inspect-signature-to-hide-internal-use-arguments/25543 "2023-04-07T04:52:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skirpichev](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/skirpichev/32/10996_2.png) [@skirpichev](https://discuss.python.org/u/skirpichev)\
**Post date:** [April 7, 2023, 4:52am UTC](https://discuss.python.org/t/an-option-for-inspect-signature-to-hide-internal-use-arguments/25543/1 "2023-04-07T04:52:35Z")

</div>

In the PEP 8, the `_single_leading_underscore` mentioned as a weak “internal use” indicator. Despite the fact it is only a naming convention there is some support for that in the language/stdlib, e.g. in star imports.

I think this could be extended to function/method signatures, e.g. with a “private” option for the inspect.signature: for private=False - underscore-prefixed keyword arguments (with defaults) will be excluded from the returned signature.

Here is an example where “internal use” option from the stdlib was completely misused: [Improve support for unnormalized Fractions](https://discuss.python.org/t/improve-support-for-unnormalized-fractions/24013)

---

<div class="post-metadata">

**Author:** ![csm10495](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/csm10495/32/9731_2.png) [@csm10495](https://discuss.python.org/u/csm10495)\
**Post date:** [April 7, 2023, 5:35am UTC](https://discuss.python.org/t/an-option-for-inspect-signature-to-hide-internal-use-arguments/25543/2 "2023-04-07T05:35:14Z")

</div>

Maybe instead add a `match` parameter that takes in a regex (or `str` of a regex). That way if someone wants to fully customize which params come back, they can do that.

For example: maybe if a param name is changing, they can drop the old name from the `signature` call.

To just hide private, one could then pass `"^_.*"`
