8.6.3.2 Accessor Methods
The mapping from OMG IDL to Python defines accessor functions for IDL attribute declarations in much the way the Java mapping does. Mapping the IDL declarations
readonly attribute string someValue; attribute string anotherValue;
yields three accessor functions: a ``get'' method for
someValue (_get_someValue()), and ``get'' and
``set'' methods for
anotherValue (_get_anotherValue() and
_set_anotherValue()). The mapping, in particular, does not
require that the IDL attributes are accessible as normal Python
attributes: object.someValue
is not required to
work, and may raise an AttributeError.
The Python DOM API, however, does require that normal attribute access work. This means that the typical surrogates generated by Python IDL compilers are not likely to work, and wrapper objects may be needed on the client if the DOM objects are accessed via CORBA. While this does require some additional consideration for CORBA DOM clients, the implementers with experience using DOM over CORBA from Python do not consider this a problem. Attributes that are declared readonly may not restrict write access in all DOM implementations.
In the Python DOM API, accessor functions are not required. If provided, they should take the form defined by the Python IDL mapping, but these methods are considered unnecessary since the attributes are accessible directly from Python. ``Set'' accessors should never be provided for readonly attributes.
The IDL definitions do not fully embody the requirements of the W3C DOM API, such as the notion of certain objects, such as the return value of getElementsByTagName(), being ``live''. The Python DOM API does not require implementations to enforce such requirements.
See About this document... for information on suggesting changes.