Re: [Python-3000] Reversing through text files with the new IO library

2007-03-13 Thread Daniel Stutzbach
On 3/12/07, Mark Russell <[EMAIL PROTECTED]> wrote: > Hopefully I'll have something in the next week or so. Daniel and > Mike - please let me know if I'm overlapping with anything you're > working on - I don't want to tread on anyone's toes. I'm not doing any work on this at the moment, but feel

Re: [Python-3000] Reversing through text files with the new IO library

2007-03-13 Thread Daniel Stutzbach
On 3/12/07, Mark Russell <[EMAIL PROTECTED]> wrote: > Yes, I suspect that BufferedReader needs some kind of readuntil() > method, so that (at least for sane encodings like utf-8) each line is > read via a single readuntil() followed by a decode() call for the > entire line. +1 .readuntil() would

Re: [Python-3000] Reversing through text files with the new IO library

2007-03-12 Thread Mark Russell
On 12 Mar 2007, at 20:18, Guido van Rossum wrote: > I would love for you to start working on this. Let me know off-line if > you need more guidance (but CC Daniel and Mike so they know what's > going on). Great! I'll start off by working up a patch that implements any easy missing stuff from ht

Re: [Python-3000] Reversing through text files with the new IO library

2007-03-12 Thread Guido van Rossum
On 3/12/07, Mark Russell <[EMAIL PROTECTED]> wrote: > On 12 Mar 2007, at 17:56, Guido van Rossum wrote: > > Thanks! This is a very interesting idea, I'd like to keep this > > around somehow. > > Thanks for the positive feedback - much appreciated. > > > I also see that you noticed a problem with te

Re: [Python-3000] Reversing through text files with the new IO library

2007-03-12 Thread Mark Russell
On 12 Mar 2007, at 17:56, Guido van Rossum wrote: > Thanks! This is a very interesting idea, I'd like to keep this > around somehow. Thanks for the positive feedback - much appreciated. > I also see that you noticed a problem with text I/O in the current > design; there's no easy way to impleme

Re: [Python-3000] Reversing through text files with the new IO library

2007-03-12 Thread Guido van Rossum
Thanks! This is a very interesting idea, I'd like to keep this around somehow. I also see that you noticed a problem with text I/O in the current design; there's no easy way to implement readline() efficiently. I want readline() to be as efficient as possible -- "for line in " should *scream*, lik

[Python-3000] Reversing through text files with the new IO library

2007-03-10 Thread Mark Russell
As an experiment with the new IO library (http://docs.google.com/Doc? id=dfksfvqd_1cn5g5m), I added support for walking through the lines of a file backwards using the reversed() iterator: for line in reversed(open(path)): ... It works by scanning backwards through the file a bl