[docs] Document typing.Text and typing.AnyStr (issue 27723)

guido at python.org guido at python.org
Wed Aug 10 19:28:05 EDT 2016


http://bugs.python.org/review/27723/diff/18103/Doc/library/typing.rst
File Doc/library/typing.rst (right):

http://bugs.python.org/review/27723/diff/18103/Doc/library/typing.rst#newcode657
Doc/library/typing.rst:657: ``AnyStr`` is a type alias meant to be used
for functions that may accept
It's not an alias, it's a type variable.

http://bugs.python.org/review/27723/diff/18103/Doc/library/typing.rst#newcode668
Doc/library/typing.rst:668: in Python 3 and ``AnyStr = TypeVar('AnyStr',
str, unicode)`` in Python 2.
No need to document what it does for Python 2 (these docs are for Python
3 only).

http://bugs.python.org/review/27723/diff/18103/Doc/library/typing.rst#newcode674
Doc/library/typing.rst:674: ``Text`` is aliased to ``unicode`` in Python
2 and ``str`` in Python 3.
Here it's more defensible to mention Python 2, but I would still focus
more on Python 3. E.g. "Text is an alias for str. It is provided to
supply a forward commpatibility path for Python 2 code; in Python 2 it
is an alias for unicode."

http://bugs.python.org/review/27723/


More information about the docs mailing list