[New-bugs-announce] [issue7828] chr() and ord() documentation for wide characters

nudgenudge report at bugs.python.org
Mon Feb 1 05:51:58 CET 2010

New submission from nudgenudge <pybug at sogetthis.com>:

The documentation of chr() and ord() fails to mention that on narrow Unicode builds, chr(n) will return a surrogate pair (hence a 2-character string) for n>=65536 and that ord(s) will accept a 2-character string if it's a surrogate pair.

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
>>> list(chr(123456))
['\ud838', '\ude40']
>>> len(chr(123456))
>>> ord(chr(123456))

assignee: georg.brandl
components: Documentation
messages: 98648
nosy: georg.brandl, nudgenudge
severity: normal
status: open
title: chr() and ord() documentation for wide characters
versions: Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list