Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59523
| 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 | <roy@panix.com> |
| 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; '"><span': 0.09; 'ascii': 0.09; 'builtin': 0.09; 'escape': 0.09; 'main()': 0.09; 'subset': 0.09; 'text"': 0.09; 'python': 0.11; 'alphabet': 0.16; 'ascii,': 0.16; 'bars,': 0.16; 'braces': 0.16; 'curly': 0.16; 'expecting': 0.16; 'non-ascii': 0.16; 'preserve': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'repr()': 0.16; 'roy': 0.16; 'subject:3.3': 0.16; 'unicode,': 0.16; 'subject:python': 0.16; 'helvetica;': 0.16; 'wrote:': 0.18; 'received:10.0.1': 0.19; 'received:166': 0.19; 'meant': 0.20; 'seems': 0.21; 'print': 0.22; 'string,': 0.24; 'unicode': 0.24; '(or': 0.24; 'header:In-Reply- To:1': 0.27; 'idea': 0.28; '0);': 0.29; 'characters': 0.30; 'medium;': 0.30; 'skip:& 60': 0.30; "i'm": 0.30; 'object.': 0.31; 'vertical': 0.31; 'skip:- 30': 0.32; 'plain': 0.33; 'rgb(0,': 0.33; 'sense': 0.34; 'done.': 0.35; 'there': 0.35; 'doing': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'received:10.0': 0.36; 'behind': 0.37; 'skip:- 20': 0.37; 'received:10': 0.37; 'auto;': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'lower': 0.61; 'new': 0.61; 'header:Message-Id:1': 0.63; 'today': 0.64; 'provide': 0.64; 'smith': 0.68; 'drivers': 0.74; 'behavior': 0.77; 'article': 0.77; '"just': 0.84; 'add-on.': 0.84; 'batchelder': 0.84; 'email addr:panix.com': 0.84 |
| Subject | Re: python 3.3 repr |
| Mime-Version | 1.0 (Apple Message framework v1283) |
| Content-Type | multipart/alternative; boundary="Apple-Mail=_E7940F57-9873-4850-94A6-3A2E56F44513" |
| From | Roy Smith <roy@panix.com> |
| In-Reply-To | <roy-66E351.09004515112013@news.panix.com> |
| Date | Fri, 15 Nov 2013 09:25:48 -0500 |
| References | <mailman.2646.1384514912.18130.python-list@python.org> <b6db8982-feac-4036-8ec4-2dc720d41a4b@googlegroups.com> <roy-66E351.09004515112013@news.panix.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2655.1384525556.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
In article <b6db8982-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
roy@panix.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 11:28 +0000
Re: python 3.3 repr Ned Batchelder <ned@nedbatchelder.com> - 2013-11-15 03:38 -0800
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 12:16 +0000
Re: python 3.3 repr Ned Batchelder <ned@nedbatchelder.com> - 2013-11-15 05:54 -0800
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 14:29 +0000
Re: python 3.3 repr Serhiy Storchaka <storchaka@gmail.com> - 2013-11-15 16:40 +0200
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 14:52 +0000
Re: python 3.3 repr Roy Smith <roy@panix.com> - 2013-11-15 09:25 -0500
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 14:43 +0000
Re: python 3.3 repr Ned Batchelder <ned@nedbatchelder.com> - 2013-11-15 07:08 -0800
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 15:39 +0000
Re: python 3.3 repr Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-15 16:49 +0100
Re: python 3.3 repr Chris Angelico <rosuav@gmail.com> - 2013-11-16 03:01 +1100
Re: python 3.3 repr Neil Cerutti <neilc@norwich.edu> - 2013-11-15 17:47 +0000
Re: python 3.3 repr Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-16 01:09 +0000
Re: python 3.3 repr Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-15 17:10 +0000
Re: python 3.3 repr Chris Angelico <rosuav@gmail.com> - 2013-11-16 04:29 +1100
Re: python 3.3 repr Cousin Stanley <cousinstanley@gmail.com> - 2013-11-15 10:45 -0700
Re: python 3.3 repr Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-15 09:50 -0500
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 15:03 +0000
Re: python 3.3 repr Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-15 10:07 -0500
Re: python 3.3 repr Chris Angelico <rosuav@gmail.com> - 2013-11-16 02:08 +1100
Re: python 3.3 repr Robin Becker <robin@reportlab.com> - 2013-11-15 15:18 +0000
Re: python 3.3 repr Roy Smith <roy@panix.com> - 2013-11-15 10:32 -0500
Re: python 3.3 repr William Ray Wing <wrw@mac.com> - 2013-11-15 11:30 -0500
Re: python 3.3 repr Zero Piraeus <z@etiol.net> - 2013-11-15 14:06 -0300
Re: python 3.3 repr Chris Angelico <rosuav@gmail.com> - 2013-11-16 04:11 +1100
Re: python 3.3 repr Serhiy Storchaka <storchaka@gmail.com> - 2013-11-15 19:37 +0200
Re: python 3.3 repr Gene Heskett <gheskett@wdtv.com> - 2013-11-15 11:36 -0500
Re: python 3.3 repr Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-15 17:58 +0000
Re: python 3.3 repr Gene Heskett <gheskett@wdtv.com> - 2013-11-15 14:23 -0500
csiph-web