Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63458
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| 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; 'string.': 0.05; 'true,': 0.05; '*not*': 0.07; 'indexing': 0.07; 'python3': 0.07; 'report.': 0.07; 'string': 0.09; '*is*': 0.09; 'bytes,': 0.09; 'bytes.': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'methods,': 0.09; 'type,': 0.09; '~ethan~': 0.09; 'python': 0.11; 'bug': 0.12; '2.7': 0.14; 'array.': 0.16; 'bytearray': 0.16; 'called.': 0.16; 'container,': 0.16; 'inconvenient': 0.16; 'porting': 0.16; 'received:69.93': 0.16; 'statements,': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'items.': 0.19; 'seems': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'bytes': 0.24; 'decide': 0.24; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'thus': 0.29; "doesn't": 0.30; "i'm": 0.30; '3.x': 0.31; 'container': 0.31; "d'aprano": 0.31; 'explained': 0.31; 'libraries': 0.31; 'steven': 0.31; 'allows': 0.31; 'class': 0.32; 'agreed': 0.32; 'run': 0.32; 'another': 0.32; 'text': 0.33; 'etc.)': 0.35; 'late': 0.35; 'no,': 0.35; 'but': 0.35; 'indexed': 0.36; 'returning': 0.36; 'charset:us-ascii': 0.36; 'too': 0.37; 'list': 0.37; 'represent': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'that,': 0.38; 'little': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'major': 0.40; 'received:173': 0.61; 'name': 0.63; 'term': 0.63; 'such': 0.63; 'between': 0.67; '(is': 0.84; 'confusion.': 0.84; 'ethan': 0.84; 'furman': 0.84; 'hopes': 0.91 |
| Date | Tue, 07 Jan 2014 16:37:08 -0800 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Bytes indexing returns an int |
| References | <52cbe15a$0$29993$c3e8da3$5496439d@news.astraweb.com> <CAF3XjbweCcbNE7Lb+JVXdThPj=jfqUChMEmB6CVOqxjh6TEvcA@mail.gmail.com> <mailman.5146.1389117017.18130.python-list@python.org> <52cc988f$0$29976$c3e8da3$5496439d@news.astraweb.com> |
| In-Reply-To | <52cc988f$0$29976$c3e8da3$5496439d@news.astraweb.com> |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator3304.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-BWhitelist | no |
| X-Source-IP | 173.12.184.233 |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | ([173.12.184.233]) [173.12.184.233]:45466 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 3 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= |
| 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.5157.1389141425.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389141425 news.xs4all.nl 2837 [2001:888:2000:d::a6]:46155 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63458 |
Show key headers only | View raw
On 01/07/2014 04:15 PM, Steven D'Aprano wrote: > Ethan Furman wrote: >> On 01/07/2014 07:19 AM, David Robinow wrote: >>> >>> Python 3 grudgingly allows the "abomination" of byte strings (is that >>> what they're called?) >> >> No, that is *not* what they're called. If you find any place in the >> Python3 docs that does call them bytestrings please submit a bug report. > > The name of the class is "bytes", but what they represent *is* a string of > bytes, hence "byte-string". It's a standard computer science term for > distinguishing strings of text from strings of bytes. I do not disagree with your statements, yet calling the bytes type a bytestring suggests things which are not true, such as indexing returning another bytestring. The core-dev have thus agreed to not call it that in the documentation in hopes of lessening any confusion. >> On 01/07/2014 08:12 AM, Steven D'Aprano wrote: >>> People trying to port these libraries from 2.7 to 3 run into this >>> problem, and it causes them grief. This little difference between bytes >>> in 2.7 and bytes in 3.x is a point of friction which makes porting >>> harder, and I'm trying to understand the reason for it. >> >> If I recall correctly the way it was explained to me: >> >> bytes (lists, arrays, etc.) is a container, and when a container is >> indexed you get whatever the container held. If you slice the container >> you get a smaller container with the appropriate items. > > (There's also a bytearray type, which is best considered as an array. Hence > the name.) Why decide that the bytes type is best considered as a list of > bytes rather than a string of bytes? It doesn't have any list methods, it > looks like a string and people use it as a string. As you have discovered, > it is an inconvenient annoyance that indexing returns an int instead of a > one-byte byte-string. > > I think that, in hindsight, this was a major screw-up in Python 3. The general consensus seems to be agreement (more or less) with that feeling, but alas it is too late to change it now. -- ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Bytes indexing returns an int Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-07 22:13 +1100
Re: Bytes indexing returns an int Ervin Hegedüs <airween@gmail.com> - 2014-01-07 12:53 +0100
Re: Bytes indexing returns an int Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-07 23:04 +1100
Re: Bytes indexing returns an int Terry Reedy <tjreedy@udel.edu> - 2014-01-07 09:29 -0500
Re: Bytes indexing returns an int David Robinow <drobinow@gmail.com> - 2014-01-07 10:19 -0500
Re: Bytes indexing returns an int Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-08 03:12 +1100
Re: Bytes indexing returns an int Serhiy Storchaka <storchaka@gmail.com> - 2014-01-07 21:48 +0200
Re: Bytes indexing returns an int Robin Becker <robin@reportlab.com> - 2014-01-08 11:05 +0000
Re: Bytes indexing returns an int wxjmfauth@gmail.com - 2014-01-08 08:08 -0800
Re: Bytes indexing returns an int Ned Batchelder <ned@nedbatchelder.com> - 2014-01-08 12:19 -0500
Re: Bytes indexing returns an int Piet van Oostrum <piet@vanoostrum.org> - 2014-01-09 18:05 +0100
Re: Bytes indexing returns an int Ethan Furman <ethan@stoneleaf.us> - 2014-01-09 09:28 -0800
Re: Bytes indexing returns an int Serhiy Storchaka <storchaka@gmail.com> - 2014-01-09 21:36 +0200
Re: Bytes indexing returns an int Michael Torrie <torriem@gmail.com> - 2014-01-08 10:25 -0700
Re: Bytes indexing returns an int David Robinow <drobinow@gmail.com> - 2014-01-07 10:23 -0500
Re: Bytes indexing returns an int Ethan Furman <ethan@stoneleaf.us> - 2014-01-07 09:02 -0800
Re: Bytes indexing returns an int Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-08 11:15 +1100
Re: Bytes indexing returns an int Chris Angelico <rosuav@gmail.com> - 2014-01-08 11:30 +1100
Re: Bytes indexing returns an int Grant Edwards <invalid@invalid.invalid> - 2014-01-08 02:34 +0000
Re: Bytes indexing returns an int Chris Angelico <rosuav@gmail.com> - 2014-01-08 14:46 +1100
Re: Bytes indexing returns an int Ethan Furman <ethan@stoneleaf.us> - 2014-01-07 16:37 -0800
csiph-web