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

Jim Fulton jim@digicool.com
Mon, 26 Jun 2000 12:50:42 -0400

Uche Ogbuji wrote:
> > Traditionally, Python attributes (including methods) with
> > names starting with '_' were treated as private.
> This is an informal tradition, not universal, and hardly normative.

I disagree on two points.

  - It is not entirely informal:

    o import * from foo 
      imports only names that don't start with '_'.

    o Private attributes are based on a leading '_'

  - Normative is hard to judge, but I think that this
    is a pretty widely used practice.

> > 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?
> We have it this way in order to follow the Python/CORBA mapping.

OK, that's why I've taken this discussion to the do-sig
and the OMG. :) I think it's worth questioning, however,
whether the Python IDL bining *must* dictate the Python

Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for