Skip to content

Instantly share code, notes, and snippets.

@EdisonChendi
Created February 3, 2017 16:01
Show Gist options
  • Save EdisonChendi/b86d3c97b0cbcbebdefeccbc2c59c8f5 to your computer and use it in GitHub Desktop.
Save EdisonChendi/b86d3c97b0cbcbebdefeccbc2c59c8f5 to your computer and use it in GitHub Desktop.
python dot operator search order
# 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