[XML-SIG] RE: DOM circular refs

Andrew M. Kuchling akuchlin@cnri.reston.va.us
Fri, 9 Oct 1998 15:26:25 -0400 (EDT)

Jeff.Johnson@stn.siemens.com writes:
>Being a Python newbie, I didn't know about __getattr__ and __setattr__ ten
>minutes ago.  Maybe mucking with those would be a good way of providing a
>readonly documentElement attribute for Document that raises an exception
>when set and returns a new proxy when got.  Currently I got rid of the
>attribute in favor of a function call get_documentElement().  What do the
>python gurus say?

	Yes, I've been meaning to write convenience __getattr__ and
__setattr__ functions on the Node class that automatically call
.get_childNodes(), for example, when you try to access .childNodes.
It's a pity that's required, because it'll make accessing .childNodes
slower than .get_childNodes() -- you'll call __getattr__ first, which
will then call get_childNodes() for you -- but it seems unavoidable.
Implementing those two methods are first on my list for tonight.

A.M. Kuchling			http://starship.skyport.net/crew/amk/
The past is only partly irrecoverable. The clerisy should accord it at least
as much courtesy as they offer to the future.
    -- Robertson Davies, _A Voice from the Attic_