[Python-projects] E1101 and dynamically generated attributes

Maarten ter Huurne maarten.ter.huurne at philips.com
Thu Jul 12 13:29:31 CEST 2007


Hi,

Because PyLint analyses the code statically, it does not know about
attributes created with setattr. As a result, it emits E1101 messages when
such a dynamically created attribute is accessed.

Currently, I know of only two ways to silence those messages:
- turn off E1101 completely:
  I don't like this, because in general it's a very useful message.
- turn off E1101 for every attribute accessed:
  I don't like this either, because there are many such accesses.

An possible alternative would be to turn off E1101 for a particular class,
like this:

class ClassWithDynamicAttributes(object):
      # pylint: disable-msg=E1101

      # (rest of class definition)

This would mean that any missing attributes on ClassWithDynamicAttributes
or any of its subclasses do not lead to E1101 being issued.

Does this approach make sense?
If so, I am willing to try and implement this; do you have any hints where
I should start?

Bye,
            Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20070712/58ce5077/attachment.htm 


More information about the Python-Projects mailing list