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


Groups > comp.lang.python > #98511

Re: using binary in python

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: using binary in python
Date Mon, 9 Nov 2015 22:04:26 +1100
Lines 14
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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de Clgobco4EUy8ccrQKRJ3sAw28EcY4vn7eZvn71qzXpfA==
Return-Path <rosuav@gmail.com>
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; 'python,': 0.02; 'received:209.85.223': 0.03; 'bytes.': 0.07; 'sequences.': 0.07; 'cc:addr:python-list': 0.09; 'bytes,': 0.09; 'bytes;': 0.09; 'encoding.': 0.09; 'semantics': 0.09; 'subject:using': 0.09; "system's": 0.09; 'python': 0.10; 'subject:python': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'text",': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'bytes': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'handles': 0.20; 'unix': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'points': 0.27; 'message-id:@mail.gmail.com': 0.27; 'point': 0.33; 'right?': 0.33; 'view,': 0.33; 'structure': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'text': 0.35; 'nov': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'operating': 0.37; 'received:209': 0.38; 'files': 0.38; 'some': 0.40; 'skip:u 10': 0.61; 'innovations': 0.66; 'goals': 0.67; 'chrisa': 0.84; 'to:none': 0.91; 'steps.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=YbKExWp+hwWVaDDoY7Ei+EXP4M0Xq6ugIFAwyw+Hvw8=; b=i0rGeZ1J/iSbNS0VTe7j+IFaOIU1B+zV9/F56imdF1Lp5YjFJF7NZlil5k/fzZ+4NP FW90Rq2XPAZtfiOOzC23UsQ8IcLZKxq6VxUrnhWa/E216niX+MCBPvQ19m+DoiQvRkX+ u9H/2aF6bmKTGNGsKEt8zhyL8USF1GQYYPArQ5nv5aFcUVEfOZTcObqXBllaPienf8tI YipAW8lVNAC8MfpG+fzx5SSXm/Ac7sSt7J8dzOmBTFW6rx2J7y85ElxzBmErAklXoLFq HiI3BlUHz8nXIfT5dlOXb7YwZNJgsVbkO5aTIyLlQVIh6t/vM4UybcDCo60L3Z6/Kh+3 G+FQ==
X-Received by 10.107.16.84 with SMTP id y81mr16255229ioi.19.1447067066509; Mon, 09 Nov 2015 03:04:26 -0800 (PST)
In-Reply-To <87d1vjigqf.fsf@elektro.pacujo.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:98511

Show key headers only | 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