Binary Python SequenceIterator Methods

The following binary methods take an input sequence argument, and produce a result sequence of the same type by applying the specified operation on the object's sequence and the corresponding elements in the input sequence.

If the two input sequence arguments are of different lengths the operation will be performed on only the number of elements in the shorter of the two sequences.

The operation can be one of the following:

add( input )

The element of the result sequence is the sum of the corresponding elements in the object and input sequences

sub( input ) The element of the result sequence is the difference of the corresponding elements in the object and input sequences
mul( input ) The element of the result sequence is the product of the corresponding elements in the object and input sequences
div( input ) The element of the result sequence is the result of dividing the element in the object by the corresponding element in input
mod( input ) The element of the result sequence is the result of taking the modulo of the element in the object by the corresponding element in input
max( input ) The element of the result sequence is the maximum of the corresponding elements in the object and input sequences
min( input ) The element of the result sequence is the minimum of the corresponding elements in the object and input sequences

Example

Following is an example code snippet demonstrating a binary method:

         
    cursor = con.cursor("Quote", "by_sym")
    for quote in cursor:
        ...
        differenceIterator = quote.high.sub(quote.close)
            
        ...