[Python-projects] pylint: E1101: Instance of 'None' has no 'xyz' member

Alexandre Fayolle alexandre.fayolle at logilab.fr
Mon Apr 14 09:58:55 CEST 2008


----- Forwarded message from Duncan Gibson <duncan at thermal.esa.int> -----

From: Duncan Gibson <duncan at thermal.esa.int>
Date: Fri, 11 Apr 2008 14:56:55 +0200
Subject: pylint: E1101: Instance of 'None' has no 'xyz' member


There are various places in my code where I have something like:

    thing = findThing()
    if thing is not None:
        thing.doIt()

but pylint reports E1101: Instance of 'None' has no 'doIt' member.

Apart from adding # pylint: disable-msg=E1101 comments everywhere
in the code, is there some way of restructuring the code to avoid
the [unnecessary?] warning?

If not, would it be possible to enhance pylint to recognise that
the access to thing.doIt is protected by a test that thing exists?

Cheers
Duncan

PS. Cc'd to Alexandre in case sending to python-projects list fails


----- End forwarded message -----

-- 
Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20080414/e8bc2d71/attachment.pgp 


More information about the Python-Projects mailing list