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 2.5? I think

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 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

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-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.next() gives

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 StopIteration, but s =

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 = StringIO.StringIO(foo)