utility functions within a class?

John Salerno johnjsal at NOSPAMgmail.com
Mon May 8 09:40:04 EDT 2006


blair.bethwaite at gmail.com wrote:
> John Salerno wrote:
>> What I originally meant was that they would not be called from an
>> instance *outside* the class itself, i.e. they won't be used when
>> writing another script, they are only used by the class itself.
> 
> Yep, so you want to encapsulate the functionality that those methods
> provide, which is the whole point of building them in a class in the
> first place.  And you want them to be private to the class so that they
> do not form part of the classes public/external interface.

But it's right that they should still be regular instance methods? So 
from within the class I still call them as self._generate_head(), etc.?



More information about the Python-list mailing list