[XML-SIG] DOM API conundrum
Fred L. Drake, Jr.
Wed, 22 Nov 2000 14:23:30 -0500 (EST)
For a long time, many of us have felt bound to the _get_/_set_
accessors for attributes defined in the DOM specification because the
Python CORBA mapping required that. (I have certainly been a big
proponent of supporting the CORBA mapping.)
Unfortunately, using the accessors makes using the DOM feel
incredibly awkward and "un-Pythonic". xml.dom.minidom only provides
accessors for a few attributes, and uses that to ease implementation
of computed attributes rather than as the preferred way to access the
As I'm working on the API documentation, I'm finding that I'd like
to document the nice, Pythonic interface and not the accessors. Is
there anyone who would have problems if I deprecate the accessors in
the documentation, and encourage direct access to the attributes? The
only issue for DOM-over-CORBA that I can see is that a wrapper would
be needed to call the _get_/_set_ methods on the surrogate when the
attributes are accessed; just a little __getattr__/__setattr__ magic
would be needed. Once the Document object is wrapped, the wrapper
could handle wrapping of other objects from the tree automatically, so
the infliction of wrappers would not need to permeate client code.
Any objections to deprecating the _get_/_set_ methods?
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations