Re: [Python-Dev] Iterating a closed StringIO

2005-11-18 Thread Guido van Rossum
On 11/18/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > For Walter's original question, my preference is to change the behavior > of regular files to raise StopIteration when next() is called on an > iterator for a closed file. I disagree. As long as there is a possibility that you might still

Re: [Python-Dev] Iterating a closed StringIO

2005-11-18 Thread Raymond Hettinger
[Guido van Rossum] > > I hope there isn't anyone here who believes this patch would be a bad > idea? [Nick Coglan] > Not me, but the Iterator protocol docs may need a minor tweak. Currently > they > say this: > > "The intention of the protocol is that once an iterator's next() method > raises > S

Re: [Python-Dev] Iterating a closed StringIO

2005-11-18 Thread Nick Coghlan
Guido van Rossum wrote: > > I hope there isn't anyone here who believes this patch would be a bad idea? Not me, but the Iterator protocol docs may need a minor tweak. Currently they say this: "The intention of the protocol is that once an iterator's next() method raises StopIteration, it will

Re: [Python-Dev] Iterating a closed StringIO

2005-11-18 Thread Walter Dörwald
Am 18.11.2005 um 02:16 schrieb Guido van Rossum: > On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: >> Am 17.11.2005 um 22:03 schrieb Guido van Rossum: >> >>> On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: [...] Should they raise the same exception? Should this be fixed for

Re: [Python-Dev] Iterating a closed StringIO

2005-11-17 Thread Guido van Rossum
On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: > Am 17.11.2005 um 22:03 schrieb Guido van Rossum: > > > On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: > >> Currently StringIO.StringIO and cStringIO.StringIO behave differently > >> when iterating a closed stream: > >> > >> s = String

Re: [Python-Dev] Iterating a closed StringIO

2005-11-17 Thread Walter Dörwald
Am 17.11.2005 um 22:03 schrieb Guido van Rossum: > On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: >> Currently StringIO.StringIO and cStringIO.StringIO behave differently >> when iterating a closed stream: >> >> s = StringIO.StringIO("foo") >> s.close() >> s.next() >> >> gives StopIteratio

Re: [Python-Dev] Iterating a closed StringIO

2005-11-17 Thread Guido van Rossum
On 11/17/05, Walter Dörwald <[EMAIL PROTECTED]> wrote: > Currently StringIO.StringIO and cStringIO.StringIO behave differently > when iterating a closed stream: > > s = StringIO.StringIO("foo") > s.close() > s.next() > > gives StopIteration, but > > s = cStringIO.StringIO("foo") > s.close() > s.nex

[Python-Dev] Iterating a closed StringIO

2005-11-17 Thread Walter Dörwald
Currently StringIO.StringIO and cStringIO.StringIO behave differently when iterating a closed stream: s = StringIO.StringIO("foo") s.close() s.next() gives StopIteration, but s = cStringIO.StringIO("foo") s.close() s.next() gives "ValueError: I/O operation on closed file". Should they raise t