Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59526

Re: python 3.3 repr

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'encoding': 0.05; 'string': 0.09; 'adopted': 0.09; 'ascii': 0.09; 'bits': 0.09; 'escape': 0.09; 'main()': 0.09; 'mess': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subset': 0.09; 'text"': 0.09; 'python': 0.11; '......': 0.16; 'alphabet': 0.16; 'ascii,': 0.16; 'bars,': 0.16; 'braces': 0.16; 'curly': 0.16; 'expecting': 0.16; 'non- ascii': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'repr()': 0.16; 'subject:3.3': 0.16; 'types,': 0.16; 'unicode,': 0.16; 'utf8': 0.16; 'subject:python': 0.16; 'variable': 0.18; 'bit': 0.19; 'meant': 0.20; 'seems': 0.21; 'print': 0.22; 'header:User-Agent:1': 0.23; 'bytes': 0.24; 'certainly': 0.24; 'days,': 0.24; 'unicode': 0.24; '(or': 0.24; 'sort': 0.25; 'least': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'leave': 0.29; 'thus': 0.29; "doesn't": 0.30; 'characters': 0.30; "i'm": 0.30; 'went': 0.31; 'easier': 0.31; 'object.': 0.31; 'vertical': 0.31; 'plain': 0.33; 'sense': 0.34; 'definition': 0.35; 'done.': 0.35; 'etc': 0.35; 'objects': 0.35; 'doing': 0.36; "didn't": 0.36; 'behind': 0.37; 'wrong': 0.37; 'two': 0.37; 'clear': 0.37; 'requiring': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'either': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'lower': 0.61; 'real': 0.63; 'today': 0.64; 'became': 0.64; 'provide': 0.64; 'received:109': 0.72; 'drivers': 0.74; '"just': 0.84; 'add-on.': 0.84; 'hood': 0.84; 'laughed': 0.84; 'popular.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robin Becker <robin@reportlab.com>
Subject Re: python 3.3 repr
Date Fri, 15 Nov 2013 14:43:17 +0000
References <mailman.2646.1384514912.18130.python-list@python.org> <b6db8982-feac-4036-8ec4-2dc720d41a4b@googlegroups.com> <roy-66E351.09004515112013@news.panix.com> <BD21979F-E8CB-41EA-9136-6C052D65DEE0@panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 109.174.168.73
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
In-Reply-To <BD21979F-E8CB-41EA-9136-6C052D65DEE0@panix.com>
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.2660.1384526610.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384526610 news.xs4all.nl 15885 [2001:888:2000:d::a6]:37635
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59526

Show key headers only | View raw


..........
> 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.
>

unfortunately the word 'printable' got into the definition of repr; it's clear 
that printability is not the same as unicode at least as far as the print 
function is concerned. In my opinion it would have been better to leave the old 
behaviour as that would have eased the compatibility.

The python gods don't count that sort of thing as important enough so we get the 
mess that is the python2/3 split. ReportLab has to do both so it's a real issue; 
in addition swapping the str - unicode pair to bytes str doesn't help one's 
mental models either :(

Things went wrong when utf8 was not adopted as the standard encoding thus 
requiring two string types, it would have been easier to have a len function to 
count bytes as before and a glyphlen to count glyphs. Now as I understand it we 
have a complicated mess under the hood for unicode objects so they have a 
variable representation to approximate an 8 bit representation when suitable etc 
etc etc.

> 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.
>
.....
I can certainly remember those days, how we cried and laughed when 8 bits became 
popular.
-- 
Robin Becker

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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