[XML-SIG] Ugh! Why are DOM access methods spelled with a leading '_'?

Fred L. Drake, Jr. fdrake@beopen.com
Fri, 23 Jun 2000 12:58:52 -0700 (PDT)

Jim Fulton writes:
 > Traditionally, Python attributes (including methods) with 
 > names starting with '_' were treated as private.

  Yes, and this works well.

 > Why oh why then does the Python DOM implementation use 
 > method names beginning with '_'s in the public API (for
 > getting attributes), as in '_get_nodeType'? Why not 
 > 'get_nodeType' or 'getNodeType'? Is the intent that these
 > functions shouldn't be called by Python code?

  This is a function of the CORBA IDL mapping; DOM is specified in
IDL.  I've looked at this and, however unfortunate, there are very
good reasons for using the underscore in this way with the mapping.
The names of the get and set methods must not map onto normal IDL
identifiers, which can't start with an underscore.

 > Is there are description somewhere of the Python DOM mapping, 
 > other than the DOM sources?

  The W3C documentation gives the IDL mapping, which requires the
Python specific mapping.


Fred L. Drake, Jr.  <fdrake at beopen.com>