Namespaces: The Whole Story
Now that we’ve examined class and instance objects, the Python namespace story is complete. For reference, I’ll quickly summarize all the rules used to resolve names here. The first things you need to remember are that qualified and unqualified names are treated differently, and that some scopes serve to initialize object namespaces:
- Unqualified names (e.g., X) deal with scopes.
- Qualified attribute names (e.g., object.X) use object namespaces.
- Some scopes initialize object namespaces (for modules and classes).