Q: names with underscores and style
Thomas A. Bryan
tbryan at arlut.utexas.edu
Tue Aug 3 21:37:11 EDT 1999
I'm writing an abstract class, call it MyClass.
It's meant to be used like this:
class SubClass(MyClass):
# implementation...
obj = SubClass()
obj.run()
The run() method of MyClass calls other methods of MyClass.
My question is whether all of the methods other than run()
should be named with a leading underscore (since no one but
the programmer doing the subclassing should have to see them)
or should I begin with a letter the names of run() *and* all
of the methods that I intend for programmers to override.
Basically, I'm trying to figure out when to use a leading
underscore for a method/member name. Is there some rule of
thumb for underscores in Python names?
---Tom
More information about the Python-list
mailing list