Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103586
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Dan Sommers <dan@tombstonezero.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: How to read from a file to an arbitrary delimiter efficiently? |
| Date | Sat, 27 Feb 2016 14:40:33 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 18 |
| Message-ID | <nasch0$3kd$1@dont-email.me> (permalink) |
| References | <56cea44e$0$11128$c3e8da3@news.astraweb.com> <mailman.115.1456385844.20994.python-list@python.org> <56d17d13$0$1596$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sat, 27 Feb 2016 14:40:33 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="7afa85ad1f051434641aa58aa18198d3"; logging-data="3725"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nzqBkjqQfk46tLaBdsKCUdC82wD80oto=" |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| Cancel-Lock | sha1:Thh7/HYPd9NYT0xI6yJx3do9zwo= |
| Xref | csiph.com comp.lang.python:103586 |
Show key headers only | View raw
On Sat, 27 Feb 2016 21:40:17 +1100, Steven D'Aprano wrote: > Thanks for finding the issue, but the solutions given don't suit my > use case. I don't want an iterator that operates on pre-read blocks, I > want something that will read a record from a file, and leave the file > pointer one entry past the end of the record. A file is a stream of bytes, but you want to view it as a stream of records. It sounds like you want an abstraction layer, and it sounds like you also want to let the file leak through that layer when it's convenient. (Yes, I spun that horribly on purpose, and I understand the use case of imposing some structure on part of a file, and possibly a different structure on a different part of a file. MIME messages and literate programming files spring to mind.) Perhaps (as I think ChrisA suggested), you could provide your own buffering/chunking layer between your application and the file itself, and never let the application see the file directly.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to read from a file to an arbitrary delimiter efficiently? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-25 17:50 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-02-25 08:37 +0100
Re: How to read from a file to an arbitrary delimiter efficiently? Steven D'Aprano <steve@pearwood.info> - 2016-02-27 21:40 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Dan Sommers <dan@tombstonezero.net> - 2016-02-27 14:40 +0000
Re: How to read from a file to an arbitrary delimiter efficiently? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-27 12:03 -0500
Re: How to read from a file to an arbitrary delimiter efficiently? Marko Rauhamaa <marko@pacujo.net> - 2016-02-27 19:47 +0200
Re: How to read from a file to an arbitrary delimiter efficiently? Chris Angelico <rosuav@gmail.com> - 2016-02-25 18:30 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Steven D'Aprano <steve@pearwood.info> - 2016-02-27 20:49 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Chris Angelico <rosuav@gmail.com> - 2016-02-27 23:17 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Chris Angelico <rosuav@gmail.com> - 2016-02-27 23:18 +1100
Re: How to read from a file to an arbitrary delimiter efficiently? Serhiy Storchaka <storchaka@gmail.com> - 2016-02-27 17:23 +0200
Re: How to read from a file to an arbitrary delimiter efficiently? Paul Rubin <no.email@nospam.invalid> - 2016-02-24 23:48 -0800
Re: How to read from a file to an arbitrary delimiter efficiently? wxjmfauth@gmail.com - 2016-02-25 06:37 -0800
Re: How to read from a file to an arbitrary delimiter efficiently? wxjmfauth@gmail.com - 2016-02-25 06:38 -0800
Re: How to read from a file to an arbitrary delimiter efficiently? BartC <bc@freeuk.com> - 2016-02-27 16:35 +0000
Re: How to read from a file to an arbitrary delimiter efficiently? BartC <bc@freeuk.com> - 2016-02-27 20:03 +0000
Re: How to read from a file to an arbitrary delimiter efficiently? BartC <bc@freeuk.com> - 2016-02-27 20:28 +0000
Re: How to read from a file to an arbitrary delimiter efficiently? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-02-28 20:28 +0000
Re: How to read from a file to an arbitrary delimiter efficiently? Tim Delaney <timothy.c.delaney@gmail.com> - 2016-02-29 08:00 +1100
csiph-web