class Iterator.Iterator: def first (self): return item def next (self): return item def iterator (self): return self |
This class provides a uniform access to loop over an object's content in a sequential manner. It is especially used to loop over all the entries in a database (see the iterator method in the DataBase class), or all the entries matching a given criterion (see Selection class).
None is returned to indicate the end of the sequence.
item = iterator.first () |
This method returns the first item of a sequence. The kind of item depends on how the Iterator has been instanciated.
item = iterator.next () |
Returns the next item in a sequence. The loop must have been initialized with first().
None is returned to indicate the end of the sequence.
iter = iterator.iterator () |
This methods returns self. It is useful in order to create methods that can indifferently accept a DataBase or an Iterator as argument, as both will provide an iterator () function.