A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-February/012726.html below:

[Python-Dev] unichr

[Python-Dev] unichrKa-Ping Yee ping@lfw.org
Wed, 7 Feb 2001 08:12:33 -0800 (PST)
On Tue, 6 Feb 2001, Paul Prescod wrote:
> Does anyone have an example of real code that would break if unichr and
> chr were merged? chr would return a regular string if possible and a
> Unicode string otherwise. When the two string types are merged, there
> would be no need to deprecate unichr as redundant.

At the moment, since the default encoding is ASCII, something like

    u"abc" + chr(200)

would cause an exception because 200 is outside of the ASCII range.

So if unichr and chr were merged right now as you suggest,

    u"abc" + unichr(200)

would break: unichr(200) would have to return '\xc8' (not u'\xc8')
for compatibility with chr(200), yet the concatenation would fail.
You can see that any argument from 128 to 255 would cause this
problem, since it would be outside the definitely-8-bit range and
also outside the definitely-Unicode range.


-- ?!ng




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4