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

Paul Prescod paul@prescod.net
Tue, 27 Jun 2000 15:08:10 -0700


Jim Fulton wrote:
> 
> ...
> 
> If you store the parent in the child, then you are causing a circular reference
> which is very likely to cause a leak. An API that requires implementation of
> __getattr__ to avoid storing the parent encourages storing the parent.

An API that has a getParent() method also encourages storing the parent.
The DOM is the source ofthe problem.

> There's no reason why someone should have to say "As far as I know".
> They should be able to point to the spec.

I know what we agreed to. I didn't know if everyone had got around to
implementing it correctly. "As far as I know, every Python XML parser
handles namespaces" does not imply an amgiuity in the XML namespaces
specification!

I think we have to agree to disagree here. If the FourThought guys are
up to it, we can drop the leading underscore from the method versions.

You can implement a DOM subset that only supports the method versions.
We can easily whip up adapter proxies that make your DOMs compliant with
the full attributes+methods API if interoperability becomes an issue. If
you get hundreds of Python objects to support your DOM interface then we
may think twice about being partially incompatible with them and migrate
our users to the method version. Alternately, in Python 1.7, we could
get first-class computed attribute support into Python and agree to use
that.

-- 
 Paul Prescod - Not encumbered by corporate consensus
The calculus and the rich body of mathematical analysis to which it 
gave rise made modern science possible, but it was the algorithm that 
made the modern world possible.
	- The Advent of the Algorithm (pending), by David Berlinski