serial iteration over several lists

Martin DeMello martindemello at yahoo.com
Sat Aug 21 22:29:13 CEST 2004


Within Blender, I have access to a list of Objects, each Object
containing a list of Meshes and each Mesh a list of Faces. I'd like to
implement a face iterator, with both a next() and a prev() method, such
that if I go off the end of a face list, it goes to the first face in
the next mesh, similarly for going off the end of the last mesh in an
object, and similarly for the prev() iterator.

In other words, I want to simulate appending all the faces into one long
list, but without the overhead of actually creating the list. I can
think of several ways to do it, but they all feel like solutions
'translated' from some other language - is there a nice pythonic way to
do this?

martin



More information about the Python-list mailing list