] > Re: [Python-projects] staticmethod arguments (Logilab.org)

Email Re: [Python-projects] staticmethod arguments

from
subject
Re: [Python-projects] staticmethod arguments
date
2005/04/18 09:48
On Friday 15 April à 22:25, logilab.abcx@spamgourmet.com wrote:
> PyLint of attached file:

> E0211 static StaticMethod1.DoWork 7 Method has no argument
> E0213 static StaticMethod2.DoWork 16 Method doesn't have "self" as first argument 

> Both of them shouldn't be reported.

> class StaticMethod1(object):

>     def __init__(self):
>         pass

>     @staticmethod
>     def DoWork():
>         print "Working..."

> class StaticMethod2(object):

>     def __init__(self):
>         pass

>     @staticmethod
>     def DoWork(job):
>         print "Working on %s..." % job

> StaticMethod1.DoWork()
> StaticMethod2.DoWork("something")

good point, [static|class]method as decorator are not recognized yet.
I'll fix that.

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects