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

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


> Modified Files:
> 	object.c 
> Log Message:
> Created PyObject_GenericGetIter().
> 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 *
> + PyObject_GenericGetIter(PyObject *obj)
> + {
> + 	Py_INCREF(obj);
> + 	return obj;
> + }
> + 
> + PyObject *
>   PyObject_GenericGetAttr(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/)