[omniORB] omniORBpy

Richard Gruet rgruet@ina.fr
Thu, 02 Mar 2000 13:16:06 +0100


--------------28FB07502DB58996FA416AE4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Stefan,

An IDL sequence simply doesn't exist in Python. It is mapped onto a
Python sequence (tuple or list).
Therefore:

    interface I {
        typedef sequence<X> WSeq;
        void foo(in XSeq arg);
    };

- If you are a Python caller of foo,  just pass a tuple or list of X for
<arg>.
- if you are a Python implementor of foo(), you will get a tuple or list
of X as value for <arg>.
 You should not assume that <arg> is mutable (ie is a list rather than a
tuple).

Cheers,

Richard

PS: I think  Python is far simpler to use than C++ as a language for
Corba programming,  unless you're somewhat pervert and love the C
reference management ;-)


Stefan Seefeld wrote:

> I have the following IDL construct:
>
> interface Kit
> {
>   struct Property{/*...*/};
>   typedef sequence<Property> PropertySeq;
> };
>
> In my python code I try to instantiate a PropertySeq
> but all attempts fail. My last try was
>
> properties = Warsaw.Kit.PropertySeq();
>
> which results in the message that I can't instantiate a
> 'Kit'... ('Warsaw' is the module I compile all global interface
> into)
> How should I do that ? (python's scope rules are somewhat
> confusing at least compared to the straightforward C++ way.
>

--------------28FB07502DB58996FA416AE4
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Stefan,
<p>An IDL sequence simply doesn't exist in Python. It is mapped onto a
Python sequence (tuple or list).
<br>Therefore:
<p>&nbsp;&nbsp;&nbsp; interface I {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef sequence&lt;X> WSeq;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void foo(in XSeq arg);
<br>&nbsp;&nbsp;&nbsp; };
<p>- If you are a Python caller of foo,&nbsp; just pass a tuple or list
of X for &lt;arg>.
<br>- if you are a Python implementor of foo(), you will get a tuple or
list of X as value for &lt;arg>.
<br>&nbsp;You should not assume that &lt;arg> is mutable (ie is a list
rather than a tuple).
<p>Cheers,
<p>Richard
<p>PS: I think&nbsp; Python is far simpler to use than C++ as a language
for Corba programming,&nbsp; unless you're somewhat pervert and love the
C reference management ;-)
<br>&nbsp;
<p><i>Stefan Seefeld wrote:</i>
<blockquote TYPE=CITE><i>I have the following IDL construct:</i>
<p><i>interface Kit</i>
<br><i>{</i>
<br><i>&nbsp; struct Property{/*...*/};</i>
<br><i>&nbsp; typedef sequence&lt;Property> PropertySeq;</i>
<br><i>};</i>
<p><i>In my python code I try to instantiate a PropertySeq</i>
<br><i>but all attempts fail. My last try was</i>
<p><i>properties = Warsaw.Kit.PropertySeq();</i>
<p><i>which results in the message that I can't instantiate a</i>
<br><i>'Kit'... ('Warsaw' is the module I compile all global interface</i>
<br><i>into)</i>
<br><i>How should I do that ? (python's scope rules are somewhat</i>
<br><i>confusing at least compared to the straightforward C++ way.</i>
<br>&nbsp;</blockquote>
</html>

--------------28FB07502DB58996FA416AE4--