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


Groups > comp.lang.python > #102280

Re: Mimick tac with python.

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: Mimick tac with python.
Date Sat, 30 Jan 2016 07:03:49 +0100
Organization A noiseless patient Spider
Lines 13
Message-ID <n8hjis$gte$1@dont-email.me> (permalink)
References <n8hf7c$lqe$1@aspen.stu.neva.ru> <mailman.111.1454129921.2338.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 30 Jan 2016 06:01:00 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="09360e0ab07672f4bcf79b9f96c5414e"; logging-data="17326"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18M1JF3GmiuUeFlyiZ9LrczGBjp0q9pDGM="
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
In-Reply-To <mailman.111.1454129921.2338.python-list@python.org>
Cancel-Lock sha1:N9otlPY976TBtaVCpABkHA4MSXE=
Xref csiph.com comp.lang.python:102280

Show key headers only | View raw


Am 30.01.16 um 05:58 schrieb Random832:
> On Fri, Jan 29, 2016, at 23:46, Hongyi Zhao wrote:
>> awk '{a[NR]=$0} END {while (NR) print a[NR--]}' input_file
>> perl -e 'print reverse<>' input_file
>
> Well, both of those read the whole file into memory - tac is sometimes
> smarter than that, but that makes for a more complex program.

Now I'm curious. How is it possible to output the first line as last 
again if not by remembering it from the every beginning? How could tac 
be implemented other than sucking up everything into memory?

	Christian

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


Thread

Mimick tac with python. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-01-30 04:46 +0000
  Re: Mimick tac with python. Random832 <random832@fastmail.com> - 2016-01-29 23:58 -0500
    Re: Mimick tac with python. Christian Gollwitzer <auriocus@gmx.de> - 2016-01-30 07:03 +0100
      Re: Mimick tac with python. Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-01-30 09:56 +0200
        Re: Mimick tac with python. Christian Gollwitzer <auriocus@gmx.de> - 2016-01-30 10:23 +0100
      Re: Mimick tac with python. Peter Otten <__peter__@web.de> - 2016-01-30 09:21 +0100
      Re: Mimick tac with python. Terry Reedy <tjreedy@udel.edu> - 2016-01-30 04:38 -0500
    Re: Mimick tac with python. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-01-30 06:18 +0000
  Re: Mimick tac with python. Chris Angelico <rosuav@gmail.com> - 2016-01-30 15:56 +1100

csiph-web