]> granicus.if.org Git - python/commitdiff
Add a specific mention of the term "operator overloading" and add an
authorFred Drake <fdrake@acm.org>
Mon, 12 May 2003 13:50:11 +0000 (13:50 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 12 May 2003 13:50:11 +0000 (13:50 +0000)
index entry.  Suggested to python-docs.

Doc/ref/ref3.tex

index 86c9cea3b801a3a9f3038344404f3aa69ddaf9a8..fe628e05fee2314f6288bb8727cb12bf1f7f485e 100644 (file)
@@ -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