Accessing a non-existing member on an object will raise in most case an ``++AttributeError++`` exception. This rule raises an issue when a non-existing member is accessed on a class instance and nothing indicates that this was expected. == Noncompliant Code Example ---- def access_attribute(): x = 42 return x.isnumeric() # Noncompliant ---- == Compliant Solution ---- def access_attribute(): x = "42" return x.isnumeric() ---- == Exceptions No issue will be raised: * in ``++try ... except++`` blocks when ``++AttributeError++`` is caught. * in ``++if hasattr(...)++`` blocks. * when the accessed object has methods ``++__getattribute__++`` or ``++__getattr__++``. These methods will override the default attribute access behavior. * when a class or its parent classes use ``++setattr++``. This can be used to add dynamically members to the class, even if it is not recommended. You can also disable any issue for a given class by adding it to this rule's ignoredClassesForMemberValidation property. == See * https://youtu.be/NiSqG6s8skA[The Magic of Attribute Access - by Petr Viktorin - EuroPython Conference 2014]