PyTargetExpression (String name, boolean inherited) { final List<PyTargetExpression> instanceAttributes = getInstanceAttributes(); for (PyTargetExpression instanceAttribute : instanceAttributes) { if (name.equals(instanceAttribute.getReferencedName())) { return instanceAttribute; } } if (inherited) { for (PyClass ancestor : getAncestorClasses(null)) { final PyTargetExpression attribute = ancestor.findInstanceAttribute(name, false); if (attribute != null) { return attribute; } } } return null; }