cpython/Objects
Guido van Rossum 7a6e95948c SF patch 580331 by Oren Tirosh: make file objects their own iterator.
For a file f, iter(f) now returns f (unless f is closed), and f.next()
is similar to f.readline() when EOF is not reached; however, f.next()
uses a readahead buffer that messes up the file position, so mixing
f.next() and f.readline() (or other methods) doesn't work right.
Calling f.seek() drops the readahead buffer, but other operations
don't.

The real purpose of this change is to reduce the confusion between
objects and their iterators.  By making a file its own iterator, it's
made clearer that using the iterator modifies the file object's state
(in particular the current position).

A nice side effect is that this speeds up "for line in f:" by not
having to use the xreadlines module.  The f.xreadlines() method is
still supported for backwards compatibility, though it is the same as
iter(f) now.

(I made some cosmetic changes to Oren's code, and added a test for
"file closed" to file_iternext() and file_iter().)
2002-08-06 15:55:28 +00:00
..
.cvsignore Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
abstract.c Patch #554716: Use __va_copy where available. 2002-07-28 10:23:27 +00:00
boolobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
bufferobject.c Fix SF bug 546434 -- buffer slice type inconsistent. 2002-06-25 00:25:30 +00:00
cellobject.c Use new GC API. 2001-08-29 23:54:21 +00:00
classobject.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
cobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
complexobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
descrobject.c SF patch 568629 by Oren Tirosh: types made callable. 2002-06-14 20:41:17 +00:00
dictobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
enumobject.c Remove the next() method -- one is supplied automatically by 2002-07-16 21:02:42 +00:00
fileobject.c SF patch 580331 by Oren Tirosh: make file objects their own iterator. 2002-08-06 15:55:28 +00:00
floatobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
frameobject.c Tim found that once test_longexp has run, test_sort takes very much 2002-08-01 18:50:33 +00:00
funcobject.c Extend function() to support an optional closure argument. 2002-07-11 18:30:27 +00:00
intobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
iterobject.c Make StopIteration a sink state. This is done by clearing out the 2002-07-16 20:24:46 +00:00
listobject.c Sped the usual case for sorting by calling PyObject_RichCompareBool 2002-08-04 17:47:26 +00:00
listsort.txt Checking in the doc file for "timsort". There's way too much here to 2002-08-01 00:59:42 +00:00
longobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
methodobject.c Introduce two new flag bits that can be set in a PyMethodDef method 2002-03-28 05:33:33 +00:00
moduleobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
object.c Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
obmalloc.c Remove extraneous semicolon. 2002-07-18 18:49:52 +00:00
rangeobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
sliceobject.c Silly typo. Not sure how that got in. 2002-07-19 15:52:38 +00:00
stringobject.c SF 582071 clarified the .split() method's docstring to note that sep=None 2002-08-05 06:28:21 +00:00
structseq.c Remove PyMalloc_New and PyMalloc_Del. 2002-04-12 03:05:37 +00:00
tupleobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00
typeobject.c SF patch 588728 (Nathan Srebro). 2002-08-01 14:39:25 +00:00
unicodectype.c removed "register const" from scalar arguments to the unicode 2001-06-27 22:08:26 +00:00
unicodeobject.c tighten up the unicode object's docstring a tad 2002-07-26 16:22:46 +00:00
unicodetype_db.h forgot to check in the new makeunicodedata.py script 2001-01-21 17:01:31 +00:00
weakrefobject.c Remove weakref free list. This has the side effect of fixing a memory 2002-03-27 15:18:21 +00:00
xxobject.c staticforward bites the dust. 2002-07-17 16:30:39 +00:00