The iterator methods are used to insert values into, iterate over and extract elements from sequences. Some, like
first()
,last()
andsearch()
are used to extract the first, last or found elements from a materialized sequence.next()Extract the next sequence valuereset()Reset the iterator position to the first element in the sequencefirst()Extract the first element in a materialized sequencelast()Extract the last element in a materialized sequencesubseq( from, till )Return the sub-sequence [from,till] of the object's materialized sequenceappend( values )Append the values sequence to the object's materialized sequence. The argument values may be a tuple, a list, or a single valueinsert( values )Insert the values sequence into the object's materialized sequence. The argument values may be a tuple, a list, or a single valuedelete( from, till )Delete elements in the specified range from the object's sequencesearch( from, boundary_from, to, boundary_to )Return the sequence with elements in the specified range from the object's materialized sequence. The arguments from and to specify values in the object's sequence; boundary_from and boundary_to are boundary types typically specified asexdb.SeqIteratorBoundary.MCO_SEQ_BOUNDARY_INCLUSIVE or exdb.SeqIteratorBoundary.MCO_SEQ_BOUNDARY_EXCLUSIVE
count()Return the count of elements in the object's materialized sequence.map( input )Extract from the input sequence elements with positions specified in the object's sequence. (The positions should be provided in ascending order (these are typically obtained using methods
filter_pos()
ortop_pos()
)project( field1, ... )Project the object's sequence to other fields in the materialized object. For example:
dayit = quote.day.search(DMY(1,MONTH(last),YEAR(last)), exdb.SeqIteratorBoundary.MCO_SEQ_BOUNDARY_INCLUSIVE, last, exdb.SeqIteratorBoundary.MCO_SEQ_BOUNDARY_INCLUSIVE) openit,closeit = dayit.project('open', 'close')store( other )Store the elements of the object's sequence to another sequence iterator. For example:
SequencIterator avg; avg.store(quote.low) avg.wavg(quote.high)
Example
Following is an example code snippet demonstrating the use of iteration method
next()
:cursor = con.cursor("Quote", "by_sym") for quote in cursor: ... print "%s: %f" % (quote.symbol, quote.close.next()) ...