From: Fred Drake <fdrake@acm.org>
Date: Tue, 19 Sep 2000 18:21:25 +0000 (+0000)
Subject: Moshe Zadka <mzadka@geocities.com>:
X-Git-Tag: v2.0b2~195
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d27f898b2a601039859cc12e105f567e5d0e946;p=python

Moshe Zadka <mzadka@geocities.com>:
Document the __contains__() method.
(Patch slightly modified by FLD.)

This closes SourceForge patch #101387.
---

diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex
index 1b072962f9..53e919fdd9 100644
--- a/Doc/ref/ref3.tex
+++ b/Doc/ref/ref3.tex
@@ -1172,6 +1172,16 @@ involving extended slice notation, or in absence of the slice methods,
 \method{__getitem__()}, \method{__setitem__()} or \method{__delitem__()} is
 called with a slice object as argument.
 
+The membership test operators (\keyword{in} and \keyword{not in}) are
+normally implemented as iteration loop through the sequence.  However,
+sequence objects can supply the following special method with a more
+efficient implementation:
+
+\begin{methoddesc}[sequence object]{__contains__}{self, item}
+Called to implement membership test operators.  Should return true if
+\var{item} is in \var{self}, false otherwise.
+\end{methoddesc}
+
 
 \subsection{Emulating numeric types\label{numeric-types}}