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

tpassin@home.com tpassin@home.com
Mon, 26 Jun 2000 19:37:32 -0400


Jim Fulton continued the attributes thread -

I still don't see why anyone is still arguing about whether the DOM rec
makes Python use attributes.  I doesn't.  In fact, it says that what are
called "attributes" in the IDL definitions are NOT supposed to be attributes
in implementations, and that the get/set accessor functions don't have to
store/retrieve from actual objects, let alone attributes of objects.

So can we at least lay this part of it to rest?  Now if most people think it
is more 'Pythonic' to use attributes, or if there are clearcut performance
benefits, then we have a basis for discussion. But let's quit talking about
whether the DOM rec makes us do attributes.
...
> > Are you proposing all access through functions?
>
> Yes.
>

I second this.

> ....
>
> We weem to be arguing two issues:
>
>   - Whether to expose DOM attributes as Python attributes or
>     accessor functions, and
>
>   - How to spell the accessor functions.
>
> If we go with accessor functions, which I think would be
> a good idea, then the accessor functions should be
> names in a way that is consistent with Python practice.
>
>....
> > Most of the difficulties in implementing the DOM are
> > impementaiton specific.  For an in memory version in python, you don't
> > need computed atributes.
>
> You do if you want to avoid circular references.
>
> > If you want to write a pulldom, you probably
> > will.
>
> We could and should avoid the issue altogether by using access methods.
> If someone wants to store the attributes, then the access methods
> can simply return them. If computation is needed, then that's easy
> enough.
>
> By using attribute syntax, then you force people to deal with
> getattr unless they want circular references, at least for
> attributes that deal with parents, siblings and such.

Attributing-ly yours,

Tom Passin