Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31575ce

Browse files
committed
Note that __getitem__() may receive a slice object as the index;
reported by Detlef Lannert <[email protected]>.
1 parent 0299749 commit 31575ce

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/ref/ref3.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,9 @@ \subsection{Emulating sequence and mapping types\label{sequence-types}}
10951095

10961096
\begin{methoddesc}[mapping object]{__getitem__}{self, key}
10971097
Called to implement evaluation of \code{\var{self}[\var{key}]}.
1098-
For a sequence types, the accepted keys should be integers. Note that
1099-
the special interpretation of negative indices (if the class wishes to
1098+
For sequence types, the accepted keys should be integers and slice
1099+
objects.\obindex{slice} Note that
1100+
the special interpretation of negative indexes (if the class wishes to
11001101
emulate a sequence type) is up to the \method{__getitem__()} method.
11011102
If \var{key} is of an inappropriate type, \exception{TypeError} may be
11021103
raised; if of a value outside the set of indexes for the sequence

0 commit comments

Comments
 (0)