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

Dieter Maurer dieter@handshake.de
Tue, 27 Jun 2000 21:15:47 +0200 (CEST)


Jim Fulton writes:
 > Uche Ogbuji wrote:
 > > 
 > > > Traditionally, Python attributes (including methods) with
 > > > names starting with '_' were treated as private.
 > > 
 > > This is an informal tradition, not universal, and hardly normative.
 > 
 > I disagree on two points.
 > 
 >   - It is not entirely informal:
 > 
 >     o import * from foo 
 >       imports only names that don't start with '_'.
This affects only objects in modules.
There is no such statement for class attributes/methods.

 >     o Private attributes are based on a leading '_'
 >       spelling
Who says?

 >   - Normative is hard to judge, but I think that this
 >     is a pretty widely used practice.
In fact, I do it to indicate that I do not expect that
the attribute/method is used outside of the class or
its derived classes.

However, I would not blame the DO-SIG for using '_' prefixed
accessor functions. Because the rule is never explicitely stated.



Dieter