[Python-Dev] len(chr(i)) = 2?
Alexander Belopolsky
alexander.belopolsky at gmail.com
Fri Nov 19 17:53:58 CET 2010
I was recently surprised to learn that chr(i) can produce a string of
length 2 in python 3.x. I suspect that I am not alone finding this
behavior non-obvious given that a mistake in Python manual stating the
contrary survived several releases. [1] Note that I am not arguing
that the change was bad. In Python 2.x, \U escapes have been
producing surrogate pair on narrow builds for a long time if not since
introduction of unicode. I do believe, however that a change like
this [2] and its consequences should be better publicized. I have not
found any discussion of this change in PEPs or "What's new" documents.
The closest find was a mentioning of a related issue #3280 in the 3.0
NEWS file. [3] Since this feature will be first documented in the
Library Reference in 3.2, I wonder if it will be appropriate to
mention it in "What's new in 3.2"?
[1] http://bugs.python.org/issue7828
[2] http://svn.python.org/view?view=rev&revision=56395
[3] http://www.python.org/download/releases/3.0.1/NEWS.txt
More information about the Python-Dev
mailing list