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

Duncan Gibson duncan at thermal.esa.int
Mon Apr 14 10:51:06 CEST 2008


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. My apologies for the duplicate post, if it gets through, but I'm
    testing because I have some difficulties submitting to the list.


More information about the Python-Projects mailing list