[Python-Dev] Who approved PyObject_GenericGetIter()??? (original) (raw)

Guido van Rossum guido@python.org
Mon, 17 Mar 2003 07:26:24 -0500


Modified Files: object.c Log Message: Created PyObjectGenericGetIter(). Factors out the common case of returning self.

Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -d -r2.199 -r2.200 *** object.c 19 Feb 2003 03:19:29 -0000 2.199 --- object.c 17 Mar 2003 08:22:56 -0000 2.200 *************** *** 1302,1305 **** --- 1302,1312 ---- PyObject * + PyObjectGenericGetIter(PyObject *obj) + { + PyINCREF(obj); + return obj; + } + + PyObject * PyObjectGenericGetAttr(PyObject *obj, PyObject *name) {

Huh? Where was this agreed upon? iter returning self doesn't sound very generic to me, so at the very least the name should be changed IMO. Also, adding a standard API for a helper function this trivial doesn't really make sense to me.

So maybe I'm missing something. Please explain.

--Guido van Rossum (home page: http://www.python.org/~guido/)