Commit 9a053731 authored by Georg Brandl's avatar Georg Brandl

#4517: add "special method" glossary entry and clarify when __getattribute__ is bypassed.

parent fe879e8a
...@@ -498,6 +498,12 @@ Glossary ...@@ -498,6 +498,12 @@ Glossary
(subscript) notation uses :class:`slice` objects internally (or in older (subscript) notation uses :class:`slice` objects internally (or in older
versions, :meth:`__getslice__` and :meth:`__setslice__`). versions, :meth:`__getslice__` and :meth:`__setslice__`).
special method
A method that is called implicitly by Python to execute a certain
operation on a type, such as addition. Such methods have names starting
and ending with double underscores. Special methods are documented in
:ref:`specialnames`.
statement statement
A statement is part of a suite (a "block" of code). A statement is either A statement is part of a suite (a "block" of code). A statement is either
an :term:`expression` or a one of several constructs with a keyword, such an :term:`expression` or a one of several constructs with a keyword, such
......
...@@ -2370,7 +2370,7 @@ the instance when looking up special methods:: ...@@ -2370,7 +2370,7 @@ the instance when looking up special methods::
True True
In addition to bypassing any instance attributes in the interest of In addition to bypassing any instance attributes in the interest of
correctness, implicit special method lookup may also bypass the correctness, implicit special method lookup generally also bypasses the
:meth:`__getattribute__` method even of the object's metaclass:: :meth:`__getattribute__` method even of the object's metaclass::
>>> class Meta(type): >>> class Meta(type):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment