[XML-SIG] Ugh! Why are DOM access methods spelled with a leading
Fri, 23 Jun 2000 16:35:47 -0400
"Fred L. Drake, Jr." wrote:
> 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.
Are you saying that there is a danger that there
might be an interface with an attribute 'foo' and
a method 'get_foo' (or 'getFoo' or whatever)? I believe
that other language mappings don't worry about this.
For example, the C++ mapping uses 'get_foo'.
> > 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.
I agree. IMO, the Python IDL mapping is broken. :(
Jim Fulton mailto:email@example.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