Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1443,10 +1443,12 @@ access (use of, assignment to, or deletion of ``x.name``) for class instances.

.. method:: object.__getattr__(self, name)

Called when an attribute lookup has not found the attribute in the usual places
(i.e. it is not an instance attribute nor is it found in the class tree for
``self``). ``name`` is the attribute name. This method should return the
(computed) attribute value or raise an :exc:`AttributeError` exception.
Called when the default attribute access fails with an :exc:`AttributeError`
(either :meth:`__getattribute__` raises an :exc:`AttributeError` because
*name* is not an instance attribute or an attribute in the class tree
for ``self``; or :meth:`__get__` of a *name* property raises
:exc:`AttributeError`). This method should either return the (computed)
attribute value or raise an :exc:`AttributeError` exception.

Note that if the attribute is found through the normal mechanism,
:meth:`__getattr__` is not called. (This is an intentional asymmetry between
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document :meth:`__getattr__` behavior when property :meth:`get` method
raises :exc:`AttributeError`.