[XML-SIG] 4DOM future
Ken MacLeod
ken@bitsko.slc.ut.us
02 Nov 1999 12:29:29 -0600
uche.ogbuji@fourthought.com writes:
> 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?
My take on ``language bindings'' means to use conventions of the
target language in defining in the binding API[*]. In the case of
node.get_parent(), if that means using underscore instead of mixed
case, because it's more common in Python, I agree with that.
More specifically, in the case of node.parent, there's already
precedence for that in the DOM spec itself, the ECMA Script binding:
<http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html>
[* others disagree, preferring to use a strict transliteration of the
Java binding because it's there in the spec and widely implemented in
Java.]
--
Ken MacLeod
ken@bitsko.slc.ut.us