diff options
author | Fred Drake <fdrake@acm.org> | 2003-05-12 13:50:11 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2003-05-12 13:50:11 (GMT) |
commit | 7af9f4dac372536ecae1e7510643b7c6b08ee2d4 (patch) | |
tree | e733d7e6be68de654a04648997c4a353be52e612 /Doc/ref | |
parent | 24b2bc365467218ee719f6155d04b1f2962742c1 (diff) | |
download | cpython-7af9f4dac372536ecae1e7510643b7c6b08ee2d4.zip cpython-7af9f4dac372536ecae1e7510643b7c6b08ee2d4.tar.gz cpython-7af9f4dac372536ecae1e7510643b7c6b08ee2d4.tar.bz2 |
Add a specific mention of the term "operator overloading" and add an
index entry. Suggested to python-docs.
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref3.tex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 86c9cea..fe628e0 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -939,7 +939,10 @@ with regular slices. A class can implement certain operations that are invoked by special 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 this class, then \code{x[i]} is equivalent to \code{x.__getitem__(i)}. Except where mentioned, attempts to execute |