Iterator Python SequenceIterator Methods

The iterator methods are used to insert values into, iterate over and extract elements from sequences. Some, like first(), last() and search() are used to extract the first, last or found elements from a materialized sequence.

next()
Extract the next sequence value
reset()
Reset the iterator position to the first element in the sequence
first()
Extract the first element in a materialized sequence
last()
Extract the last element in a materialized sequence
subseq( from, till )
Return the sub-sequence [from,till] of the object's materialized sequence
append( values )
Append the values sequence to the object's materialized sequence. The argument values may be a tuple, a list, or a single value
insert( values )
Insert the values sequence into the object's materialized sequence. The argument values may be a tuple, a list, or a single value
delete( from, till )
Delete elements in the specified range from the object's sequence
search( 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 as exdb.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() or top_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())
        ...