Documenting `tuple` return type in a function docstring for PyCharm type hinting

I contacted PyCharm support, and this is what they said:

For tuple please use (<type_1>, <type_2>, <type_3>, e t.c.) syntax.

E.g.:

"""
:rtype: (string, int, int)
"""

This is confirmed in PyCharm’s documentation:

Type Syntax

Type syntax in Python docstrings is not defined by any standard. Thus, PyCharm suggests the following notation:

  • (Foo, Bar) # Tuple of Foo and Bar

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)