Hacker News new | ask | show | jobs
by mkesper 3573 days ago
"Private" fields and methods should use one underscore. Two underscores are for name mangling issues and __method__ is for "magic" methods.
2 comments

I'd say that private methods are double underscored, and protected methods are single underscored, since the goal of the __ is to prevent child classes from being able to use the parent implementation via self.__meth.
Not prevented from being able to use, but from accidentally using or overriding the parent's. The child can still use the mangled name.
Well, private fields are all members starting with an underscore and that are not publicised in the documentation.

/That/ includes double underscores mangled members and and "magic" methods.