Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #67005
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) |
| Date | 2014-02-25 00:18 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <87d2ic2lyq.fsf@elektro.pacujo.net> (permalink) |
| References | <mailman.7328.1393271688.18130.python-list@python.org> <87ha7o9r2q.fsf@elektro.pacujo.net> <mailman.7331.1393275892.18130.python-list@python.org> |
random832@fastmail.us: > On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: >> That is: >> >> 1. ineffient (encode/decode shuffle) >> >> 2. unnatural (strings usually have no place in protocols) > > That's not at all clear. Why _aren't_ these protocols considered text > protocols? Why can't you add a string directly to headers? Text expresses a written human language. In prosaic terms, a Python string is a sequence of ISO 10646 characters, whose codepoints are not octets. Most network protocols are defined in terms of octets, although many of them can carry textual, audio or video payloads (among others). So when RFC 3507 (ICAP) shows an example starting: RESPMOD icap://icap.example.org/satisf ICAP/1.0 Host: icap.example.org Encapsulated: req-hdr=0, res-hdr=137, res-body=296 it consists of 8-bit octets and not some human language. In practical terms, you get the bytes off the socket as, well, bytes. It makes little sense to "decode" those bytes into a string for manipulation. Manipulating bytes directly is both more efficient and more natural from the point of view of the standard. Many internet protocols happen to look like text. It makes it nicer for human network programmers to work with them. However, they are primarily meant for computers, and the message formats are really a form of binary code. Marko
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 11:54 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Marko Rauhamaa <marko@pacujo.net> - 2014-02-24 22:46 +0200
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) random832@fastmail.us - 2014-02-24 16:04 -0500
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Marko Rauhamaa <marko@pacujo.net> - 2014-02-25 00:18 +0200
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 23:55 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) wxjmfauth@gmail.com - 2014-02-25 00:07 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-25 08:29 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 13:53 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-24 23:55 +0000
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Ethan Furman <ethan@stoneleaf.us> - 2014-02-24 16:10 -0800
Re: Python 3.5, bytes, and %-interpolation (aka PEP 461) Steven D'Aprano <steve@pearwood.info> - 2014-02-25 07:29 +0000
csiph-web