When Python evaluates a.b, it follows a defined search path rather than the LEGB rule used for variables. The path is ICPO: instance, class, parents, and object. section 9.10
The lookup proceeds in this order:
- Check the instance a for an attribute named b; return it if found. section 9.10
- If the instance lacks b, check type(a), the object's class. section 9.10
- Continue through parent classes and object when the earlier searches do not provide the attribute. section 9.10
Methods found on a class
For s = 'abcd', s.upper() first checks the string instance, then str.upper. Finding upper on str retrieves the method and invokes it through s. Similarly, an instance of Bar can call x2 from Foo and x3 from Bar.

