Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63460
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!ra.nrl.navy.mil!bloom-beacon.mit.edu!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Bytes indexing returns an int |
| Date | Wed, 8 Jan 2014 02:34:29 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 21 |
| Message-ID | <laidfl$do7$1@reader1.panix.com> (permalink) |
| 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> <mailman.5155.1389141054.18130.python-list@python.org> |
| NNTP-Posting-Host | c-24-118-110-103.hsd1.mn.comcast.net |
| X-Trace | reader1.panix.com 1389148469 14087 24.118.110.103 (8 Jan 2014 02:34:29 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Wed, 8 Jan 2014 02:34:29 +0000 (UTC) |
| User-Agent | slrn/1.0.1 (Linux) |
| Xref | csiph.com comp.lang.python:63460 |
Show key headers only | View raw
On 2014-01-08, Chris Angelico <rosuav@gmail.com> wrote: > On Wed, Jan 8, 2014 at 11:15 AM, Steven D'Aprano ><steve+comp.lang.python@pearwood.info> wrote: >> 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. > > Which part was? The fact that b'ASDF'[0] in Python2 yeilds something different than it does in Python3 -- one yields b'A' and the other yields 0x41. It makes portable code a lot harder to write. I don't really have any preference for one over the other, but changing it for no apparent reason was a horrible idea. -- Grant
Back to comp.lang.python | Previous | Next — Previous in thread | Next 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