Python › Multiple Inheritance & MRO

How does Python handle attribute (not just method) resolution across multiple inheritance, and can it lead to surprising shadowing?

Advanced

Answer

Class-level attribute lookup follows the same MRO as method lookup -- Python searches each class in MRO order for the attribute name and returns the first match. This means a class attribute defined on an earlier class in the MRO shadows one with the same name defined on a later class, which can cause surprising bugs if two unrelated mixins happen to define an attribute with the same name for different purposes.
class MixinA:
    status = 'A-status'

class MixinB:
    status = 'B-status'

class Combined(MixinA, MixinB):
    pass

print(Combined.status)  # 'A-status' -- MixinA wins due to MRO order, MixinB's is shadowed silently
Real-world example Two independently-authored mixins both happen to define a class attribute named `config`, and combining them silently uses only one mixin's value, causing a hard-to-trace bug until someone inspects the MRO.

Common follow-ups: How would you detect this kind of accidental name collision proactively?;Why do naming conventions like prefixing mixin attributes help avoid this?