[Python-Dev] PyObject_GenericGetIter() (original) (raw)
Guido van Rossum guido@python.org
Mon, 17 Mar 2003 10:22:00 -0500
- Previous message: [Python-Dev] PyObject_GenericGetIter()
- Next message: [Python-Dev] PyObject_GenericGetIter()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Where was this agreed upon?
Perhaps I overstepped. It's been on my todo list for a couple of months and didn't seem to be even slightly controversial.
> iter returning self doesn't sound very generic to me, > so at the very least the name should be changed IMO. Thomas suggested PyObjectGetSelfIter, PyObjectGenericSelfIter, or PyObjectSelfIter. Consistent with the other tpslot fillers, I suggest PyObjectGenericIter.
The "generic" functions aren't just slot fillers, they do a lot of work that is typical for most types.
The self-iter, OTOH, doesn't do what most types' iterators need -- it only does what most iterators need for their own iterator. So a name with 'Self' in it is more appropriate.
I'd pick PyObject_SelfIter.
> Also, adding a standard API for a helper function this > trivial doesn't really make sense to me.
This identical code was duplicated in a dozen different modules in the same context. It comes up when writing most iterators and needed to be factored out.
"Need" is a strong word. It's okay to add this little convenience, but please give it a proper name. Maybe some day we'll have a true generic iterator helper too.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] PyObject_GenericGetIter()
- Next message: [Python-Dev] PyObject_GenericGetIter()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]