[XML-SIG] Ugh! Why are DOM access methods spelled with a
leading '_'?
Walter Doerwald
walter@livinglogic.de
Mon, 26 Jun 2000 17:15:53 +0200
At 02:37 26.06.00, you wrote:
I should note that I quite hope that leading-underscore-means-private is
indeed not normative, and never will be so. The leading underscore is the
most readable way to escape symbol names that would clash with an applicable
naming convention. It's far from a conclusive argument (though Jim Fulton
tried to make a similar argument to excoriate the Python/CORBA binding), but
most languages, such as C++ allow exactly this approach as put to good use=
by
the C++/CORBA binding.
The leading-underscore-is-private idea has the annoying effect that if I=
want
to call a variable "class", I must instead use the silly "klass", rather=
than
"_class", which is far more readable and self-explanatory. And if I want to
call variables "def", "type" and "else", what then? "deph", "tipe" and=
"els"?
(I suppose one could use trailing underscore).
Most likely, Guido is already in his time machine writing "Thou shalt not=
use
leading underscore except for private variables" on a stone tablet somewhere
in the past to end the whole argument. But people have been saying nasty
things about the Python/CORBA binding which wouldn't be as nasty as the=
things
I'd say about such a restriction in Python.
Well the Python style guide=
(http://www.python.org/doc/essays/styleguide.html)
says:
* _single_leading_underscore: weak "internal use" indicator
(e.g. "from M import *" does not import objects whose name starts with
an underscore).
* single_trailing_underscore_: used by convention to avoid conflicts=
with
Python keyword, e.g. Tkinter.Toplevel(master, class_=3D"ClassName").
Bye,
Walter D=F6rwald
--
Walter D=F6rwald =B7 LivingLogic AG =B7 Bayreuth, Germany =B7 www.livinglogi=
c.de