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


Groups > comp.lang.python > #98511

Re: using binary in python

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: using binary in python
Date 2015-11-09 22:04 +1100
Message-ID <mailman.169.1447067069.16136.python-list@python.org> (permalink)
References <20151108212706.GA29701@z-sverige.nu> <mailman.168.1447065689.16136.python-list@python.org> <87d1vjigqf.fsf@elektro.pacujo.net>

Show all headers | View raw


On Mon, Nov 9, 2015 at 9:56 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> One of the principal UNIX innovations was to see files as simple byte
> sequences. The operating system would place no semantics on the meaning
> or structure of the bytes.

And you also want to see those files as containing "plain text",
right? Unfortunately, those two goals are in conflict. Either a file
is nothing but bytes, or it contains text in some encoding. From the
file system and operating system's points of view, the files are
indeed nothing but bytes; but from the application's point of view,
text is text and bytes is bytes. In Python, a text file is opened with
a specific encoding, and Python handles the encode/decode steps.

ChrisA

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


Thread

Re: using binary in python Michiel Overtoom <motoom@xs4all.nl> - 2015-11-09 11:40 +0100
  Re: using binary in python Marko Rauhamaa <marko@pacujo.net> - 2015-11-09 12:56 +0200
    Re: using binary in python Chris Angelico <rosuav@gmail.com> - 2015-11-09 22:04 +1100
      Re: using binary in python Marko Rauhamaa <marko@pacujo.net> - 2015-11-09 15:25 +0200
        Re: using binary in python Chris Angelico <rosuav@gmail.com> - 2015-11-10 00:52 +1100
          Re: using binary in python Marko Rauhamaa <marko@pacujo.net> - 2015-11-09 16:32 +0200
            Re: using binary in python Chris Angelico <rosuav@gmail.com> - 2015-11-10 02:17 +1100
              Re: using binary in python Marko Rauhamaa <marko@pacujo.net> - 2015-11-09 17:46 +0200
                Re: using binary in python Chris Angelico <rosuav@gmail.com> - 2015-11-10 02:57 +1100
                Re: using binary in python Marko Rauhamaa <marko@pacujo.net> - 2015-11-09 18:17 +0200

csiph-web