Hi,

Another false positive, for static members of a class, similar to the below 
sited
one for static members of a module.

Note that no error messages about bb for as-is program is issued. Uncommenting
any commented-out line changes the number of error messages. Uncommenting line
#               self.bb += val
increases the number or error messages (adds 3 about bb), any other line,
decreases it.

$ cat t.py
#!/usr/bin/env python

class Klass:
        aa = 0
        bb = 0
        cc = 0

        def __init__(self):
#               self.aa = 0
#               self.cc = 0
                pass

        def incr(self, val):
                if val > self.aa:
                        val = self.aa
                if val < self.bb:
                        val = self.bb
                self.aa += val
#               self.bb += val
                self.cc += val
#               self.aa = val
#               self.cc = int(val)

$ pylint -e t.py
************* Module t
E: 14:Klass.incr: Instance of 'Klass' has no 'aa' member
E: 15:Klass.incr: Instance of 'Klass' has no 'aa' member
E: 18:Klass.incr: Instance of 'Klass' has no 'aa' member
E: 20:Klass.incr: Instance of 'Klass' has no 'cc' member

Best regards,
Vladimir

On Tue, 08 Sep 2009 13:57:34 +0300, Vladimir Chukharev 
<vladimir.chukha...@tut.fi> wrote:

Hallo,

I think, this is a false positive, and I could not find a corresponding ticket.

$ cat t.py
#!/usr/bin/env python
import serial
print 'EIGHTBITS =', serial.EIGHTBITS

$ ./t.py
EIGHTBITS = 8

$ pylint -e t.py
************* Module t
E:  3: Module 'serial' has no 'EIGHTBITS' member

$ pylint --version
pylint 0.18.1,
astng 0.19.1, common 0.45.0
Python 2.6.2 (r262:71600, Aug 17 2009, 08:50:57)
[GCC 4.2.1 20070719  [FreeBSD]]


Thanks again for the great software!
Vladimir
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to