Best place for a function?

Inyeol Lee inyeol.lee at siliconimage.com
Tue Mar 13 11:43:02 EDT 2007


On Sun, Mar 11, 2007 at 06:36:02PM +0100, Bruno Desthuilliers wrote:
> 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 ?

Namespace.
Plz check this old thread. It explains some usage of staticmethod.
  http://mail.python.org/pipermail/python-list/2003-February/190258.html

--Inyeol



More information about the Python-list mailing list