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

Mike Olson Mike.Olson@fourthought.com
Mon, 26 Jun 2000 10:45:26 -0600

Jim Fulton wrote:
> >
> > Actually, the DOM can be mapped into a language in a manner that does
> > not follow directly from the IDL and CORBA specs. That's why there is a
> > formally defined java binding rather than just a reference to the IDL
> > specs. Historically, though, 4DOM was really a CORBA tool so it really
> > needed to follow the specs.
> Whatever we do, there needs to be a document somewhere that
> says what the Python DOM mapping is, even if it is not
> much more than a reference to the DOM IDL and the Python
> binding.

In 4DOM, we are actually moving away from __getattr__ (for speed). 
We've found that we can keep all of the data cached in attributes for
when it is needed.  The draw back is that 4DOM will break horribly if
people access out side of the DOM interface (or 4DOM supported pythonic
interface) and there is a bit of runtime performance lose, however that
is minor compared to the perfomace hit from __getattr__.  The only
reason we still support the '_'* is for legacy.


> > I would vote for losing the leading underscore.
> :)
> > > This says to me that the DOM API specifies use of methods
> > > for interface attributes.
> >
> > I think it is safe to say that a binding should not require a particular
> > underlying data structure but Python allows the use of a.b syntax even
> > when the surface structure is wildly different than the underlying data
> > structure. I'm preaching to the choir as you are the world leader in
> > abuse of the dot notation. :)
> Yup, however __getattr__ is a pain to utilize unless you have alot of
> infrustructure.  Zope has support for computed attributes, which makes
> this pretty sane, especially for read-only attributes.  I'm working on
> a new version of StructuredText, StructuredText NG,
> http://www.zope.org/Members/jim/StructuredTextWiki/StructuredTextNG,
> which, among other things, creates objects with a DOM interface.
> I want this to be independent of Zope, so I can't use any of the standard
> Zope getattr tricks.
> In general, I think it would be cool of lots of
> objects supported the DOM interface and I hate to make people
> jump over the getattr barrier to do that.
> Jim
> --
> 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
> repeats.
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig

Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python