Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'backwards': 0.09; '--v': 0.16; '12:17,': 0.16; 'binary.': 0.16; 'inverse': 0.16; 'reversed': 0.16; 'time"': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'tim': 0.18; '>>>': 0.18; 'to:name:python-list@python.org': 0.20; 'file.': 0.20; 'assuming': 0.22; 'finally,': 0.22; 'example': 0.23; 'external': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '---': 0.26; '(which': 0.26; 'charset:iso-8859-15': 0.26; 'order.': 0.27; 'question': 0.27; 'record': 0.28; '>>>>': 0.29; 'chase': 0.29; 'separated': 0.29; 'smart': 0.29; '(and': 0.32; 'file': 0.32; 'could': 0.32; 'utility': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'but': 0.36; 'subject: (': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'your': 0.60; 'first': 0.61; 'provide': 0.62; 'details': 0.63; 'more': 0.63; 'reverse': 0.65; 'manner.': 0.66; 'wish': 0.70; 'subject:Fast': 0.84; 'subject:read': 0.84; 'subject:write': 0.84 X-SENDER-IP: [213.112.50.224] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuguAIXjhlDVcDLgPGdsb2JhbAANN4pOs1qDYAEBAQE4glIBAQEBAzhAEQsYCRYPCQMCAQIBMRQGDQgBAbA6gymQL4tfhl4Dkj+WXA X-IronPort-AV: E=Sophos;i="4.80,637,1344204000"; d="scan'208";a="432412290" Date: Tue, 23 Oct 2012 20:37:04 +0200 From: Virgil Stokes User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "python-list@python.org" Subject: Re: Fast forward-backward (write-read) References: <5086AA35.4000509@it.uu.se> <5086C156.40707@tim.thechases.com> <5086D13F.80006@it.uu.se> <5086DA4D.4060204@tim.thechases.com> In-Reply-To: <5086DA4D.4060204@tim.thechases.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351018926 news.xs4all.nl 6977 [2001:888:2000:d::a6]:60469 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31952 On 23-Oct-2012 19:56, Tim Chase wrote: > On 10/23/12 12:17, Virgil Stokes wrote: >> On 23-Oct-2012 18:09, Tim Chase wrote: >>>> Finally, to my question --- What is a fast way to write these >>>> variables to an external file and then read them in >>>> backwards? >>> Am I missing something, or would the fairly-standard "tac" >>> utility do the reversal you want? It should[*] be optimized to >>> handle on-disk files in a smart manner. >> Not sure about "tac" --- could you provide more details on this >> and/or a simple example of how it could be used for fast reversed >> "reading" of a data file? > Well, if you're reading input.txt (and assuming it's one record per > line, separated by newlines), you can just use > > tac < input.txt > backwards.txt > > which will create a secondary file that is the first file in reverse > order. Your program can then process this secondary file in-order > (which would be backwards from your source). > > I might have misunderstood your difficulty, but it _sounded_ like > you just want to inverse the order of a file. Yes, I do wish to inverse the order, but the "forward in time" file will be in binary. --V