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

Jim Fulton jim@digicool.com
Tue, 27 Jun 2000 10:34:00 -0400


Uche Ogbuji wrote:
> 
> > Mike Olson wrote:
> > >
> > > 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).
> >
> > IMO, this is strong evidence that the Python DOM should
> > *not* use attributes for implementing the DOM/IDL attributes.
> 
> Not so fast.  We've mostly solved the speed problem.  And we could solve a
> good deal more of it by getting rid of accessor/mutator functions.

Could you elaborate on this? Who is we? I'm implementing a DOM 
for StructuredTextNG and I can't see a way to avoid using getattr if
I want to avoid circular references.  How have you solved the
speed problem for me?

In general, I'd like it to be relatively easy to implement DOM
on non-xml-specific objects that I want to process with DOM-aware
tools, like 4XSLT.  Requiring that these objects implement the 
DOM attributes as actual attributes or that the objects implement
getattr seems pretty burdonsome to me.

> This whole argument actually makes mandating only attributes more attractive
> to me.

I can live with whatever we decide (although I have no idea how we
go about coming to a decision ;), however, the discussion has
convinced me that the DOM API should map DOM attributes to
Python attributes. Sigh.

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.