method = Klass.othermethod considered PITA

Terry Reedy tjreedy at
Sun Jun 5 09:34:37 CEST 2005

> Steven Bethard wrote:
>> John J. Lee wrote:
>>> It seems nice to do this
>>> class Klass:
>>>     def _makeLoudNoise(self, *blah):
>>>         ...
>>>     woof = _makeLoudNoise
>> Out of curiosity, why do you want to do this?

I have occasionally seen this usage where it made sense.  I vaguely 
remember cases where the same function/method met two demands that required 
two different names.  An example would be a __special__ method also exposed 
publicly as 'special' ( something) without the underscores.  Or some other 
interface required a different name.

A related usage is a true specialization in which one or more parameters is 
given a default or constant value.

Terry J. Reedy

More information about the Python-list mailing list