Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'encoding': 0.05; 'subject:Python': 0.06; 'binary': 0.07; 'wrapped': 0.09; 'xml.': 0.09; 'cc:addr:python-list': 0.11; 'binary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'proportion': 0.16; 'readable': 0.16; 'unpacked': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'portion': 0.22; 'cc:addr:python.org': 0.22; 'text,': 0.24; 'text.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'largest': 0.30; "d'aprano": 0.31; 'layer': 0.31; 'steven': 0.31; 'subject:some': 0.31; 'file': 0.32; 'quite': 0.32; 'text': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'e.g.': 0.38; 'files': 0.38; 'expect': 0.39; 'according': 0.40; 'read': 0.60; "you're": 0.61; 'information': 0.63; 'kind': 0.63; 'between': 0.67; 'to:none': 0.92 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=/Lc4AWBdqRdhWxVrq2oVqniAbBUYCAVuQlwdvfSfLIw=; b=j2wiUneq96k8hONnoTBfagJ9N8KG1bX8vWjvb/k14RmuSYxeO2byvw3VZABUnOgHqe sy8O/aRMi3PjFM6OVgh1bwbxxP/cEmhER5l65DqOnOwrddsL5NFOZfrXRi2PLZf9KctS RUKuPL9ZaNn9+/4ewKQiRa30fOPMjMoEFFatl7uxPxLat4Slgf/jJAEnRhKkHsjzRgzm f+tDJN16tlUDRovY50v7lbETjp2WAlUP12anBE9CCAtMhVpu+ssEbcZTztDV/NvGOlOp fQvifQBwP01IrBe3hEBXewg0mkhiq6Jea9vqTqt+JbQzycoIApj7gaPbzggkf5I4PTrx 8rjw== MIME-Version: 1.0 X-Received: by 10.220.133.197 with SMTP id g5mr38129258vct.20.1401813812678; Tue, 03 Jun 2014 09:43:32 -0700 (PDT) In-Reply-To: <538df925$0$29978$c3e8da3$5496439d@news.astraweb.com> References: <538a8f48$0$29978$c3e8da3$5496439d@news.astraweb.com> <538bcfff$0$29978$c3e8da3$5496439d@news.astraweb.com> <538df925$0$29978$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 4 Jun 2014 02:43:32 +1000 Subject: Re: Python 3.2 has some deadly infection From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401813821 news.xs4all.nl 2931 [2001:888:2000:d::a6]:41052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72535 On Wed, Jun 4, 2014 at 2:34 AM, Steven D'Aprano wrote: > Outside of those three kinds of files, I would expect that *by far* the > single largest kind of file is text. Some text is wrapped in a binary > layer, e.g. .doc, .odt, etc. but an awful lot of it is good old human > readable text, including web pages (html) and XML. In terms of file I/O in Python, text wrapped in a binary layer has to be treated as binary, not text. There's no difference between a JPEG file that has some textual EXIF information and an ODT file that's a whole lot of zipped up text; both of them have to be read as binary, then unpacked according to the container's specs, and then the text portion decoded according to an encoding like UTF-8. But you're quite right that a large proportion of files out there really are text. ChrisA