Pardon me jumping into the discussion so late, and perhaps missing something too, but since I've done a lot of c++ coding, here's a few observations:
1. It seems that the discussion of iterators and the discussion of implementing generators are pretty closely linked, at least for basic iterator types. For the basic iterator types, I could see having a special generator type that accepts starting and ending iterator instances, or methods of the C++ class (such as .begin() and .end() for vector), as constructor arguments. At this level they are conceptual quite similar, at least using the STL iterator concept. It does not seem to me like accessing the iterators directly (e.g. through .inc) is needed if it is provided through fast C-level generators. Most of the way the STL is stitched together is so conceptually similar to python generators, especially in Py3, that it should be part of this discussion, and the C++ STL ideal is to minimize the need for low level operations on the iterators. (Robert, I have a book on exactly the concepts of iterators and generic programming with the C++ STL if you'd like to borrow it for a while; I'll contribute what I can, but I'm really busy now.) 2. Also, what types in the STL iterator type hierarchy should we support? There are forward iterators, backward iterators, bidirectional iterators which generalize those, and random access iterators which generalize those. In addition, there are reading and writing versions of these iterators. Plus const/non-const version to worry about. Big pain, I know, but seems like good c++ wrapping will have to deal with all this. From experience, forward and backward iterators are the most common, with random access being next, though these all could perhaps be wrapped in other generator or class types... my 2c, --Hoyt ++++++++++++++++++++++++++++++++++++++++++++++++ + Hoyt Koepke + University of Washington Department of Statistics + http://www.stat.washington.edu/~hoytak/ + [email protected] ++++++++++++++++++++++++++++++++++++++++++ _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
