Next: 4.14 Server-side Mapping Up: 4.13 Client Side Mapping Previous: 4.13.2 Mapping for Operations

## 4.13.3 Mapping for Attributes

Interface attributes map to two methods on the corresponding Python stub class, an accessor and a modifier. The accessor has the same name as the attribute but prefixed with ```_get_`'', and similarly, the modifier is prefixed with ```_set_`''. Obviously, IDL attributes defined as `readonly` only have the accessor method.

The accessor takes no parameters and returns a value of the attribute type, while the modifier takes a single parameter of the attribute type and has no return value.

e.g. consider the following IDL:

    module Example {
        interface Foo {
            attribute string change_me;
            readonly attribute long read_me;
    };

These attributes can be used in Python follows:

    >>> import Example
    >>> # Assume the variable `server' contains a reference
    >>> # to an object supporting the interface `Example.Foo'.
    >>> print server._get_change_me()
    `Some string value'
    >>> server._set_change_me(`This is the new value!')
    >>> print server._get_change_me()
    `This is the new value'
    >>> print server._get_read_me()
    1234
    >>>