Best place for a function?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Sun Mar 11 13:36:02 EDT 2007
Inyeol Lee a écrit :
> On Wed, Mar 07, 2007 at 05:27:04PM -0500, Sergio Correia wrote:
>
>>I'm writing a class, where one of the methods is kinda complex. The
>>method uses a function which I know for certain will not be used
>>anywhere else. This function does not require anything from self, only
>>the args passed by the method.
>>
>>Where should I put the function?
>
>
> Use staticmethod. It's a normal function with class namespace.
What do you think the OP will gain from making a simple helper function
a staticmethod ? Apart from extra lookup time ?
More information about the Python-list
mailing list