diff options
author | Raymond Hettinger <python@rcn.com> | 2003-03-17 08:24:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-03-17 08:24:35 (GMT) |
commit | 01538269643175877f516d09f429a2ae28136da6 (patch) | |
tree | 3b6bdbf815394deaf883b1409de3520de88959b4 /Objects/enumobject.c | |
parent | 08801db123077407ae7ec7af2fe2d65a24a46063 (diff) | |
download | cpython-01538269643175877f516d09f429a2ae28136da6.zip cpython-01538269643175877f516d09f429a2ae28136da6.tar.gz cpython-01538269643175877f516d09f429a2ae28136da6.tar.bz2 |
Created PyObject_GenericGetIter().
Factors out the common case of returning self.
Diffstat (limited to 'Objects/enumobject.c')
-rw-r--r-- | Objects/enumobject.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Objects/enumobject.c b/Objects/enumobject.c index f69a002..cd6ca67 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -78,13 +78,6 @@ enum_next(enumobject *en) return result; } -static PyObject * -enum_getiter(PyObject *en) -{ - Py_INCREF(en); - return en; -} - PyDoc_STRVAR(enum_doc, "enumerate(iterable) -> create an enumerating-iterator"); @@ -117,7 +110,7 @@ PyTypeObject PyEnum_Type = { 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc)enum_getiter, /* tp_iter */ + PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ |