cpython/Include
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
..
abstract.h Patch #552433: Special-case tuples. Avoid sub-type checking for lists. 2002-05-08 08:44:21 +00:00
bitset.h
boolobject.h Patch #551008: DL_IMPORT PyBool_FromLong. 2002-05-02 20:23:27 +00:00
bufferobject.h
cellobject.h Cells are not VAR objects. 2002-02-28 23:46:34 +00:00
ceval.h
classobject.h
cobject.h
codecs.h
compile.h Removed more hair in support of future-generator stmts. 2002-04-12 01:20:10 +00:00
complexobject.h
cStringIO.h Remove function definition from cStringIO.h. 2002-08-05 18:20:01 +00:00
descrobject.h Patch #536908: Add missing #include guards/extern "C". 2002-03-30 08:57:12 +00:00
dictobject.h Get rid of USE_CACHE_ALIGNED. It has no function anymore. 2002-04-11 20:41:18 +00:00
enumobject.h - New builtin function enumerate(x), from PEP 279. Example: 2002-04-26 19:40:56 +00:00
errcode.h Patch #534304: Implement phase 1 of PEP 263. 2002-08-04 17:29:52 +00:00
eval.h
fileobject.h SF patch 580331 by Oren Tirosh: make file objects their own iterator. 2002-08-06 15:55:28 +00:00
floatobject.h
frameobject.h SF patch # 580411, move frame macros from frameobject.h into ceval.c 2002-07-14 00:27:26 +00:00
funcobject.h
graminit.h Patch #534304: Implement phase 1 of PEP 263. 2002-08-04 17:29:52 +00:00
grammar.h
import.h Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
intobject.h Add the 'bool' type and its values 'False' and 'True', as described in 2002-04-03 22:41:51 +00:00
intrcheck.h
iterobject.h Patch #536908: Add missing #include guards/extern "C". 2002-03-30 08:57:12 +00:00
listobject.h
longintrepr.h For clarity, change _longobject to build directly from PyObject_VAR_HEAD 2002-03-02 04:33:09 +00:00
longobject.h HAVE_LIMITS_H -- raise #error if not defined; limits.h is std C 2002-07-12 05:01:20 +00:00
marshal.h
metagrammar.h
methodobject.h Introduce two new flag bits that can be set in a PyMethodDef method 2002-03-28 05:33:33 +00:00
modsupport.h
moduleobject.h
node.h
object.h Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
objimpl.h Removed WITH_CYCLE_GC #ifdef-ery. Holes: 2002-07-07 03:59:34 +00:00
opcode.h The opcode FOR_LOOP no longer exists. 2002-06-13 17:59:51 +00:00
osdefs.h
parsetok.h Fix SF Bug 564931: compile() traceback must include filename. 2002-07-09 09:23:27 +00:00
patchlevel.h
pgenheaders.h Moving pymalloc along. 2002-04-22 02:33:27 +00:00
py_curses.h
pydebug.h Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
pyerrors.h New functions for extension writers on Windows: 2002-07-29 14:27:41 +00:00
pyfpe.h
pygetopt.h
pymactoolbox.h Added one call to Py_Main(), for OSX framework builds only, that will get the 2002-08-02 14:11:24 +00:00
pymem.h Moving pymalloc along. 2002-04-28 04:11:46 +00:00
pyport.h Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
pystate.h
Python.h Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have them 2002-07-20 08:51:52 +00:00
pythonrun.h Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype 2002-08-02 02:27:13 +00:00
pythread.h
rangeobject.h
sliceobject.h This is my nearly two year old patch 2002-06-11 10:55:12 +00:00
stringobject.h - A new type object, 'string', is added. This is a common base type 2002-05-24 19:01:59 +00:00
structmember.h
structseq.h
symtable.h
sysmodule.h
token.h
traceback.h [Bug #528914] PyTraceBack_Store/Fetch were deleted in 1997, but their 2002-03-19 16:02:35 +00:00
tupleobject.h
ucnhash.h
unicodeobject.h Fix for bug [ 561796 ] string.find causes lazy error 2002-05-29 11:33:13 +00:00
weakrefobject.h