next up previous contents
Next: 4.2 Mapping for Modules Up: 4. OMG IDL to Previous: 4. OMG IDL to

4.1 Scoped Names

Fnorb uses Python packages and classes to mirror the namespaces and scoping mechanisms found in IDL. e.g. consider the following IDL:

module Example {
    interface Foo {
        struct Bar {
            string baz;
        };
    };
};
The IDL scoped names are:

To get the Python equivalent of the scoped names simply replace all of the ``::'' separators with ``.''.

>>> import Example
>>> Example
<module Example>
>>> Example.Foo
<class Example.Foo at 132f68>
>>> Example.Foo.Bar
<class Example.Bar at 132d88>

If an IDL identifier clashes with a Python keyword it is prefixed with an underscore ``_''. e.g. In the following IDL:

module Example {
    interface class {
        void while ();
     };
};

The IDL identifiers ``class'' and ``while'' are Python keywords and are therefore mapped to the Python identifiers ``_class'' and ``_while''.

>>> import Example
>>> Example._class
<class Example._class at 133fa0>
>>> Example._class._while
<unbound method _class._while>
>>>

For a list of all Python keywords see Appendix [*].



http://www.fnorb.com/
March 2000