Commit 7af9f4da authored by Fred Drake's avatar Fred Drake

Add a specific mention of the term "operator overloading" and add an

index entry.  Suggested to python-docs.
parent 24b2bc36
...@@ -939,7 +939,10 @@ with regular slices. ...@@ -939,7 +939,10 @@ with regular slices.
A class can implement certain operations that are invoked by special A class can implement certain operations that are invoked by special
syntax (such as arithmetic operations or subscripting and slicing) by syntax (such as arithmetic operations or subscripting and slicing) by
defining methods with special names. For instance, if a class defines defining methods with special names.\indexii{operator}{overloading}
This is Python's approach to \dfn{operator overloading}, allowing
classes to define their own behavior with respect to language
operators. For instance, if a class defines
a method named \method{__getitem__()}, and \code{x} is an instance of a method named \method{__getitem__()}, and \code{x} is an instance of
this class, then \code{x[i]} is equivalent to this class, then \code{x[i]} is equivalent to
\code{x.__getitem__(i)}. Except where mentioned, attempts to execute \code{x.__getitem__(i)}. Except where mentioned, attempts to execute
......
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