Skip to content

Commit 1f76c5d

Browse files
committed
Tuple returns should use types, not labels.
This is not clear from the Sphinx output unless you know what you're looking for, but nitpick mode complains if you don't use types.
1 parent bb20124 commit 1f76c5d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

stack/documenting-code-with-type-annotations.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,17 @@ A simple return type does not need backticks to create a link, but backticks may
7474
As always, types in docstrings do *not* respect imports in the file, and instead are resolved using the `Sphinx target-resolution rules`_.
7575
See :ref:`rst-python-link` for details.
7676

77-
Functions that return multiple values via a tuple should have their return types documented just like parameters, i.e. with labels and no types::
77+
Functions that return multiple values via a tuple should just have multiple
78+
entries::
7879

7980
def return_pair() -> tuple[str, int]:
8081
"""Return a pair.
8182

8283
Returns
8384
-------
84-
name
85+
str
8586
The name.
86-
id
87+
int
8788
The ID.
8889
"""
8990
return ("", 0)

0 commit comments

Comments
 (0)