| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -806,12 +806,18 @@ An attribute reference is a primary followed by a period and a name: | |||
| 806 | 806 | ||
| 807 | 807 | The primary must evaluate to an object of a type that supports attribute | |
| 808 | 808 | references, which most objects do. This object is then asked to produce the | |
| 809 | - attribute whose name is the identifier. This production can be customized by | ||
| 810 | - overriding the :meth:`__getattr__` method. If this attribute is not available, | ||
| 811 | - the exception :exc:`AttributeError` is raised. Otherwise, the type and value of | ||
| 812 | - the object produced is determined by the object. Multiple evaluations of the | ||
| 813 | - same attribute reference may yield different objects. | ||
| 814 | - | ||
| 809 | + attribute whose name is the identifier. The type and value produced is | ||
| 810 | + determined by the object. Multiple evaluations of the same attribute | ||
| 811 | + reference may yield different objects. | ||
| 812 | + | ||
| 813 | + This production can be customized by overriding the | ||
| 814 | + :meth:`~object.__getattribute__` method or the :meth:`~object.__getattr__` | ||
| 815 | + method. The :meth:`!__getattribute__` method is called first and either | ||
| 816 | + returns a value or raises :exc:`AttributeError` if the attribute is not | ||
| 817 | + available. | ||
| 818 | + | ||
| 819 | + If an :exc:`AttributeError` is raised and the object has a :meth:`!__getattr__` | ||
| 820 | + method, that method is called as a fallback. | ||
| 815 | 821 | ||
| 816 | 822 | .. _subscriptions: | |
| 817 | 823 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments