Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31993
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.051 |
| X-Spam-Evidence | '*H*': 0.90; '*S*': 0.00; 'be:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'backward': 0.16; 'iterable,': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stripped': 0.16; 'wrote:': 0.17; 'looks': 0.26; 'skip:[ 10': 0.26; 'header:X -Complaints-To:1': 0.28; '-0700,': 0.29; 'objects': 0.29; 'file': 0.32; 'could': 0.32; 'defining': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'pm,': 0.35; 'something': 0.35; 'received:org': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'subject: (': 0.36; 'drop': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'build': 0.39; 'space': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'results': 0.65; 'forward': 0.66; 'forward,': 0.84; 'subject:Fast': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'dennis': 0.91; 'received:108': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Fast forward-backward (write-read) |
| Date | Wed, 24 Oct 2012 01:23:58 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <5086AA35.4000509@it.uu.se> <CA+vVgJV6feUL0gTPC==3fp3Wq8zvRXgoyhVaUYnZNtMfF8qpLw@mail.gmail.com> <CA+vVgJWnAThHhD4cUJzXLGdVojCNA1oV_qKYwa+7UsEqS=x7XQ@mail.gmail.com> <CA+vVgJUNOZD3vBVFDXvXzdXb=c5THQG+B5dSOp_uF1nqDHhPug@mail.gmail.com> <CA+vVgJV2A7oJQCRGFypqsfYXHNVxSuhWJUhCF+FM4NWnXanGcA@mail.gmail.com> <k679kb$rs1$1@ger.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-108-79-220-228.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 3.3/32.846 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2717.1351056298.27098.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351056298 news.xs4all.nl 6963 [2001:888:2000:d::a6]:50903 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31993 |
Show key headers only | View raw
On Tue, 23 Oct 2012 16:35:40 -0700, emile <emile@fenx.com> declaimed the
following in gmane.comp.python.general:
> On 10/23/2012 04:19 PM, David Hutto wrote:
> > forward = [line.rstrip('\n') for line in f.readlines()]
>
> f.readlines() will be big(!) and have overhead... and forward results in
> something again as big.
>
Well, since file objects are iterable, could one just drop the
.readlines() ? ( ... line in f )
> > backward = [line.rstrip('\n') for line in reversed(forward)]
>
> and defining backward looks to me to require space to build backward and
> hold reversed(forward)
>
And since the line-ends have already been stripped from forward,
backward should just be:
backward = reversed(forward)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Fast forward-backward (write-read) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-24 01:23 -0400
Re: Fast forward-backward (write-read) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-24 08:05 +0000
Re: Fast forward-backward (write-read) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-24 14:36 -0400
csiph-web