Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9573
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:bug': 0.04; 'received:verizon.net': 0.07; 'terry': 0.07; 'mentions': 0.09; 'myself,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'library': 0.15; '8:26': 0.16; 'billy': 0.16; 'measured': 0.16; 'reedy': 0.16; 'pm,': 0.16; '>>>': 0.16; 'def': 0.16; 'written': 0.17; 'jan': 0.19; '(which': 0.20; 'memory': 0.21; 'loop': 0.22; 'header:In-Reply-To:1': 0.22; 'noticed': 0.26; 'efficiently': 0.30; 'lines': 0.31; 'file.': 0.32; 'does': 0.32; "what's": 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints- To:1': 0.34; 'header:User-Agent:1': 0.34; 'uses': 0.35; 'file': 0.36; 'using': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'ahead': 0.63; 'gain.': 0.84; 'subject:Possible': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Possible File iteration bug |
| Date | Fri, 15 Jul 2011 17:45:27 -0400 |
| References | <ivnh2f$rdc$1@speranza.aioe.org> <9f5ddd41-79a7-46a6-b5fe-dd94600d581a@j15g2000yqf.googlegroups.com> <ivpblc$qk4$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-74-109-121-73.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 |
| In-Reply-To | <ivpblc$qk4$1@speranza.aioe.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.1080.1310766347.1164.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310766347 news.xs4all.nl 23920 [2001:888:2000:d::a6]:42073 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9573 |
Show key headers only | View raw
On 7/15/2011 8:26 AM, Billy Mays wrote: > On 07/15/2011 04:01 AM, bruno.desthuilliers@gmail.com wrote: >> On Jul 14, 9:46 pm, Billy Mays<no...@nohow.com> wrote: >>> I noticed that if a file is being continuously written to, the file >>> generator does not notice it: >>> >>> def getLines(f): >>> lines = [] >>> for line in f: >>> lines.append(line) >>> return lines >> >> what's wrong with file.readlines() ? > > Using that will read the entire file into memory which may not be So will getLines. > possible. In the library reference, it mentions that using the generator > (which calls file.next()) uses a read ahead buffer to efficiently loop > over the file. If I call .readline() myself, I forfeit that performance > gain. Are you sure? Have you measured the difference? -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-14 15:46 -0400
Re: Possible File iteration bug Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-14 14:00 -0600
Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-14 16:15 -0400
Re: Possible File iteration bug Hrvoje Niksic <hniksic@xemacs.org> - 2011-07-14 22:39 +0200
Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-14 16:43 -0400
Re: Possible File iteration bug "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 01:01 -0700
Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-15 08:26 -0400
Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 16:21 +0200
Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-15 17:45 -0400
Re: Possible File iteration bug Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 13:42 +1000
Re: Possible File iteration bug Chris Angelico <rosuav@gmail.com> - 2011-07-16 14:07 +1000
Re: Possible File iteration bug Cameron Simpson <cs@zip.com.au> - 2011-07-17 09:28 +1000
Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-17 09:26 +0200
Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 14:39 +0200
Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-15 08:52 -0400
Re: Possible File iteration bug Chris Angelico <rosuav@gmail.com> - 2011-07-15 22:58 +1000
Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 16:28 +0200
Re: Possible File iteration bug Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-15 10:42 -0400
Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 22:46 +0200
Re: Possible File iteration bug Ethan Furman <ethan@stoneleaf.us> - 2011-07-15 14:20 -0700
Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-15 17:47 -0400
csiph-web