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

Mike Olson Mike.Olson@fourthought.com
Mon, 26 Jun 2000 13:04:00 -0600


Jim Fulton wrote:
> 
> Mike Olson wrote:
> >
> > Jim Fulton wrote:
> > >
> > > >

> >
> > 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.

Huh?  I see exactly the opposit picture.  Functions were only needed
until all of the issues with current state could be worked out.  Most of
them arose in DOM L1, but have been clarified in DL2.  Dom L3???? If we
don't need the over head of __getattr__ override then why should we have
it?  

Are you proposing all access through functions?


> 
> 
> I'd like it to be as easy as possible for various objects to implement
> the DOM. (See for example StructuredTextNG.) I'd hate to make implementers
> go through the pain and performance hit of getattr or dictate an implementation
> (like caching attributes or otherwise directly storing them, creating
> memory leaks).

To me, difficulty is more defined by the API then how we map it.  We
don't add any complexity to implementing the DOM interface to say that
finctions should start with a '_' or end with a '_'.  Its just a naming
convention.  Most of the difficulties in implementing the DOM are
impementaiton specific.  For an in memory version in python, you don't
need computed atributes.  If you want to write a pulldom, you probably
will.  If you are writing DOM in zope you will.  DOM in C++ maybe.

I think it should be left up to the implementator as to whether they
need computed attributes.  


Mike

> 
> 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.

-- 
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