Slash and star again in stdlib docs! (function signatures)

I don’t think this thread is relevant here. Yes, the inspect module has known shortcomings, that aren’t fixed yet, e.g. multiple signatures. Or annotations support in extension modules.

But this is not an obstacle for docs: sphinx already can display multiple signatures or show annotations, we don’t use something like autodoc to get this stuff from the inspect module introspection capabilities. I think there is more or less a consensus, that if a callable supports several logical signatures — documentation should list them all, one by one, each being a correct (in pure-Python) signature. It’s already possible in sphinx. E.g. for range this will be:

class range(stop, /)
class range(start, stop, step=1, /)

And most callables aren’t suffer from this problem. E.g. in the cmath module — only one function has multiple signatures.

1 Like