2 ms·
"Private" fields and methods should use one underscore. Two underscores are for name mangling issues and __method__ is for "magic" methods.
by mkesper 10y ago
"Private" fields and methods should use one underscore. Two underscores are for name mangling issues and __method__ is for "magic" methods.
- guyzmo 10y agoWell, 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.
- zardeh 10y agoI'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.
- xapata 10y agoNot prevented from being able to use, but from accidentally using or overriding the parent's. The child can still use the mangled name.