[Python-checkins] python/dist/src/Lib StringIO.py,1.28,1.29
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 31 Jan 2003 08:04:18 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv5281
Modified Files:
StringIO.py
Log Message:
Make StringIO its own iterator, similar to real files.
(This should also be done to cStringIO.)
Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** StringIO.py 17 Sep 2002 18:10:34 -0000 1.28
--- StringIO.py 31 Jan 2003 16:04:15 -0000 1.29
***************
*** 60,64 ****
def __iter__(self):
! return iter(self.readline, '')
def close(self):
--- 60,72 ----
def __iter__(self):
! return self
!
! def next(self):
! if self.closed:
! raise StopIteration
! r = self.readline()
! if not r:
! raise StopIteration
! return r
def close(self):