[Patches] [ python-Patches-463698 ] add iterator IF to StringIO/cStringIO

noreply@sourceforge.net noreply@sourceforge.net
Fri, 21 Sep 2001 21:27:03 -0700


Patches item #463698, was opened at 2001-09-21 15:21
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=463698&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Barry Warsaw (bwarsaw)
Assigned to: Barry Warsaw (bwarsaw)
Summary: add iterator IF to StringIO/cStringIO

Initial Comment:
The following patch adds support for the iterator
interface in both StringIO and cStringIO.  Like file
objects, iter(aStringIO) or iter(a_cStringIO) gives an
iterator object whose .next() method traverses by
calling readline() on the underlying object, raising
StopIteration when an empty string is reached.

----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-09-21 21:27

Message:
Logged In: YES 
user_id=12800

Checking in the code & test case.  I think the documentation
can refer to the fact that StringIO's are file-like, so when
file objects document that they can be iterated over, so
will StringIO's. <wink back atcha>


----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-09-21 20:14

Message:
Logged In: YES 
user_id=12800

Thank you. :)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-09-21 15:48

Message:
Logged In: YES 
user_id=31435

The code looks fine, but you need doc changes and some new 
test cases (in test_StringIO.py) too.  But you knew that, 
so I won't insult you by mentioning it <wink>.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=463698&group_id=5470