Name conflict in class hierarchy

Scott David Daniels scott.daniels at acm.org
Mon May 22 19:12:50 EDT 2006


bruno at modulix wrote:
> Ralf Muschall wrote:
>> Jeffrey Barish wrote:
>>
>> [overriding of base class member functions by subclass] ....
>> In Python, a function not intended to be overriden should be either
>> have a name starting with an underscore
> 
> actually with *two* underscores. The single-leading-underscore naming
> scheme is the convention for 'protected' (read: 'implementation, not
> API') attributes.

The double-underscore is there to generate names that are unlikely to
accidentally conflict.  Use for anything else simply annoys those of
us who may need to get access to those instances and methods.

-- 
--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list