Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; '"> In-Reply-To: Date: Fri, 15 Nov 2013 09:25:48 -0500 References: To: python-list@python.org X-Mailer: Apple Mail (2.1283) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 140 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384525556 news.xs4all.nl 15942 [2001:888:2000:d::a6]:53576 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59523 --Apple-Mail=_E7940F57-9873-4850-94A6-3A2E56F44513 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii In article , Ned Batchelder wrote: > In Python3, repr() will return a Unicode string, and will preserve = existing=20 > Unicode characters in its arguments. This has been controversial. To = get=20 > the Python 2 behavior of a pure-ascii representation, there is the new=20= > builtin ascii(), and a corresponding %a format string. I'm still stuck on Python 2, and while I can understand the controversy = ("It breaks my Python 2 code!"), this seems like the right thing to have = done. In Python 2, unicode is an add-on. One of the big design drivers = in Python 3 was to make unicode the standard. The idea behind repr() is to provide a "just plain text" representation = of an object. In P2, "just plain text" means ascii, so escaping = non-ascii characters makes sense. In P3, "just plain text" means = unicode, so escaping non-ascii characters no longer makes sense. Some of us have been doing this long enough to remember when "just plain = text" meant only a single case of the alphabet (and a subset of ascii = punctuation). On an ASR-33, your C program would print like: MAIN() \( PRINTF("HELLO, ASCII WORLD"); \) because ASR-33's didn't have curly braces (or lower case). Having P3's repr() escape non-ascii characters today makes about as much = sense as expecting P2's repr() to escape curly braces (and vertical = bars, and a few others) because not every terminal can print those. -- Roy Smith roy@panix.com --Apple-Mail=_E7940F57-9873-4850-94A6-3A2E56F44513 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii b6db= 8982-feac-4036-8ec4-2dc720d41a4b@googlegroups.com>,
Ned = Batchelder <ned@nedbatchelder.com> = wrote:

In Python3, repr() will return a = Unicode string, and will preserve existing
Unicode characters in its arguments.  This has been = controversial.  To get
the= Python 2 behavior of a pure-ascii representation, there is the new =
builtin ascii(), and a = corresponding %a format string.

I'm still = stuck on Python 2, and while I can understand the controversy ("It = breaks my Python 2 code!"), this seems like the right thing to have = done.  In Python 2, unicode is an add-on.  One of the big = design drivers in Python 3 was to make unicode the = standard.

The idea behind repr() is to provide = a "just plain text" representation of an object.  In P2, "just = plain text" means ascii, so escaping non-ascii characters makes sense. =  In P3, "just plain text" means unicode, so escaping non-ascii = characters no longer makes sense.

Some of us = have been doing this long enough to remember when "just plain text" = meant only a single case of the alphabet (and a subset of ascii = punctuation).  On an ASR-33, your C program would print = like:

MAIN() \(
= PRINTF("HELLO, ASCII WORLD");
\)

because ASR-33's didn't have = curly braces (or lower case).

Having P3's = repr() escape non-ascii characters today makes about as much sense as = expecting P2's repr() to escape curly braces (and vertical bars, and a = few others) because not every terminal can print = those.

--
Roy = Smith

=
= --Apple-Mail=_E7940F57-9873-4850-94A6-3A2E56F44513--