[Python-projects] [pylint] class members issue

Nadia Alramli nadiana at gmail.com
Mon Jul 21 18:42:46 CEST 2008


Hi,

I noticed that pylint is not accepting the use of class members as
arguments to decorators inside the class, example:

def decorator(value):
     def wrapper(function):
          return function
     return wrapper

class foo:
    member = 10

    @decorator(member) #This will cause pylint to complain
    def test(self):
         pass

pylint will complain about "Undefined variable 'member'"

while:
    @decorator(foo.member)
    def test(self):
         pass

Will work according to pylint.

However the first case works in python while the second one doesn't.
Any ideas to workaround this?


More information about the Python-Projects mailing list