[docs] [issue29002] typing.AnyStr doc is unclear about python2 unicode support
report at bugs.python.org
Sat Dec 17 18:53:44 EST 2016
New submission from Alex Jurkiewicz:
The typing.AnyStr documentation:
It gives some examples using u-strings (u'foo') but doesn't make explicit some subtleties about behaviour with Python 2. Specifically, with Python 2 all the given examples work, and even this works:
Which seems contrary to the goal of AnyStr being "used for functions that may accept any kind of string without allowing different kinds of strings to mix".
I think the documentation should call out that for Python 2, AnyStr doesn't distinguish between str & unicode, and mention that in python 2, b'str' is equivalent to 'str' (I know this is mentioned elsewhere, but it seems useful to repeat it here).
assignee: docs at python
nosy: aj, docs at python
title: typing.AnyStr doc is unclear about python2 unicode support
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Python tracker <report at bugs.python.org>
More information about the docs