I have a method that accepts a unicode parameter in Python 2, but in Python 3 it accepts a str.
I am wondering how I should write the sphinx docstring for this function:
:param unicode text: or :param str text: or a seperate documentation for Python 2 and Python 3?
Example:
def myfunction(text):
"""Do something with text
:param unicode text: Must be unicode
:rtype: unicode
:raises TypeError: If text is not a unicode
"""
if PY2 and not isinstance(text, unicode):
raise TypeError("Argument 'text' must be unicode")
...
return text