[XML-SIG] Re: XML-SIG digest, Vol 1 #392 - 11 msgs

Thomas B. Passin tpassin@idsonline.com
Wed, 3 Nov 1999 08:26:31 -0500


> From: uche.ogbuji@fourthought.com

[snip]
> Also, we are thinking of eliminating the getSpam() and setEggs()
convention.
> Right now, one uses
>
> node.getParent()
>
> to access the DOM attribute
>
> node.parent
>
> We are thinking of simply doing the same thing in Python.
>
> The problem is that DOM adherence is still very important to us, and there
are
> some things we'd have to do that require __getattr__ and __setattr__, and
I
> know that these can slow things down quite a bit.
>
> I'm assuming that's why PyDOM uses
>
> node.get_parent()
>
> Any comment about the "right" way, Python as well as DOM-wise?
>
>

If you are going to deviate from the published API, make sure it is done in
a consistent way so that the new api can be machine-generated from the
standard.  This will also help humans write the correct calls by hand.

Pure object-orented folks want node.getParent() instead of node.parent so
the caller is not messing with the internals of the called object itself.  A
redesign could totally change the way in which getParent() works without
changing the call at all, which is desirable.

In Python, is it possible and efficient to redefine node.getParent() to
simply return node.parent? If so, you could have the benefits of both ways.

Regards,

Tom Passin