Next: 4.10 Mapping for Exceptions Up: 4. OMG IDL to Previous: 4.8 Mapping for Structures

# 4.9 Mapping for Sequences and Arrays

IDL sequences (both bounded and unbounded) and arrays map directly into Python lists. e.g. consider the following IDL:

    module Example {
        interface Foo {
            typedef sequence<long> sequenceVector;
            void bar(in sequenceVector v);

            typedef long arrayVector[10];
            void baz(in arrayVector v);
        };
    };

In Python the interface `Foo` can be used as follows:

    >>> import Example

    >>> # Assume the variable `server' contains a reference
    >>> # to an object supporting the interface `Example.Foo'.

    >>> server.bar([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
    >>> server.baz([100, 101, 102, 103, 104, 105, 106, 107, 108, 109])

If an attempt is made to pass a bounded sequence that exceeds its maximum length, or an array that does not contain the appropriate number of elements, a `BAD_PARAM` system exception is raised.