the.bay.news

Runtime docstrings for type aliases

Discussions on Python.org
Runtime docstrings for type aliases
Hi! I propose preserving a string literal immediately following a type statement as the resulting alias object’s __doc__ attribute, with support in pydoc to display it in help(). type Timeout = float | None """ Maximum wait in seconds. Use None to wait indefinitely, or zero to return immediately. """ Under this proposal, Timeout.__doc__ would contain that documentation, and help(Timeout) would be: Help on type alias Timeout in module mymodule: type Timeout = float | None Maximum wait in...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.