[Python-Dev] method decorators (PEP 318)

Phillip J. Eby pje at telecommunity.com
Mon Mar 29 09:28:41 EST 2004


At 01:16 PM 3/29/04 +1000, Dave Harrison wrote:
> > If we were designing Python 3.0 here, I would probably suggest the
> > following syntax for classmethods:
> >
> >   def foo(class cls, x, y):
> >     ...
> >
> > and wouldn't bother with staticmethods at all. How often do you
> > actually need a staticmethod in particular and *not* a classmethod?
>
>It's quite useful to be able to develop, essentially stateless, static
>method utility libraries that dont need to be class based.  Why create
>an object if you simply don't need one ?

Just define a function, then.  All staticmethod does is let you put a 
function in a class and have it remain a function instead of a method.


>If this was an option, there would have to be a way to use it without
>the class element,

There is: just define a function.  No staticmethod required.





More information about the Python-Dev mailing list