utility functions within a class?
John Salerno
johnjsal at NOSPAMgmail.com
Sun May 7 23:23:21 EDT 2006
John Salerno wrote:
> jeffshannon at gmail.com wrote:
>
>> Even if you don't end up referring to self or any instance
>> attributes within the method
>
> Hmm, follow-up: I *do* plan to refer to instance attributes inside these
> methods (self.something), but does that require that they be instance
> methods, or can they still reference 'self' since they are inside the class?
>
> They won't be called directly from an instance, which is why I wondered
> about making them static or class methods, but can static or class
> methods use self, or does it have to be an instance method in that case?
Ugh, sorry about another post, but let me clarify: In these utility
functions, I need to refer to an attribute of an instance, but these
functions will be called from another method in the class, not from the
instance itself. Is this even possible, or would 'self' have no meaning
when used this way?
More information about the Python-list
mailing list