Private methods

Ian Kelly ian.g.kelly at gmail.com
Tue Oct 9 13:08:13 EDT 2012


On Tue, Oct 9, 2012 at 8:08 AM, Demian Brecht <demianbrecht at gmail.com> wrote:
> A single underscore semantically means private. A double underscore will
> name mangle the function such that it's only accessible strictly by name
> through the class that it's define in. Note that you *can* still access it
> if you understand how name mangling works. Nothing in Python is truly
> private.

I tend to view name mangling as being more for avoiding internal
attribute collisions in complex inheritance structures than for
designating names as private.



More information about the Python-list mailing list