Created
February 3, 2017 16:01
-
-
Save EdisonChendi/b86d3c97b0cbcbebdefeccbc2c59c8f5 to your computer and use it in GitHub Desktop.
python dot operator search order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python . operator search order | |
# 1. if magic methods are used implicitly, those methods on object's type are used | |
# 2. __getattributes__(self, attr) | |
# 3. object's type's __dict__ and it's a data descriptor, return it | |
# 4. object's __dict__ and it's a data descriptor, return it | |
# 5. object's __dict__ then object's type's __dict__ | |
# 6. __getattr__ | |
# 7. raise AttributeError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment