"private" methods require 2 underscores

Hi everyone - consider this constructive criticism: Python requires 2
underscores to define a private method. I was just looking through some of
the mixin stuff and noticed methods preceded by a single underscore with
comments that it is private. (FWIW. I realize there really isn't such a
thing as a private method in Python.)
-Rick King

Rick King wrote:

Hi everyone - consider this constructive criticism: Python requires 2
underscores to define a private method. I was just looking through some of
the mixin stuff and noticed methods preceded by a single underscore with
comments that it is private.

This is a pretty common standard in Python. While using a single underscore doesn't invoke any name-mangling or other compiler/interpreter-based protection schemes, by convention it denotes a class-internal attribute that is not part of the published interface. This way, programmers know that there's no guarantees about how the method works, or whether it will continue to work in the same way (or even exist!) in future versions. However, it's still usable if absolutely necessary (though such usage is discouraged).

Jeff Shannon
Technician/Programmer
Credit International

This is a pretty common standard in Python. While using a single
underscore doesn't invoke any name-mangling or other
compiler/interpreter-based protection schemes, by convention it denotes
a class-internal attribute that is not part of the published interface.
This way, programmers know that there's no guarantees about how the
method works, or whether it will continue to work in the same way (or
even exist!) in future versions. However, it's still usable if
absolutely necessary (though such usage is discouraged).

Thanks. I thought there must be some logic to it.