diff options
author | Fred Drake <fdrake@acm.org> | 2000-12-07 04:49:34 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-12-07 04:49:34 (GMT) |
commit | 0c4755935251c2231086fe6636ab2104b7a8edc6 (patch) | |
tree | 27d97178f03a7558d720fb35bf36246027dbc88e /Doc/ref | |
parent | 16942f22243b939e79f432cf27d347c4e97a3929 (diff) | |
download | cpython-0c4755935251c2231086fe6636ab2104b7a8edc6.zip cpython-0c4755935251c2231086fe6636ab2104b7a8edc6.tar.gz cpython-0c4755935251c2231086fe6636ab2104b7a8edc6.tar.bz2 |
Added a note that objects which emulate built-in types should only
implement as many of the relevant methods as make sense for the particular
information being modelled.
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref3.tex | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 905a001..0222110 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -841,6 +841,13 @@ a list object, \code{x.__getitem__(i)} is not equivalent to operation raise an exception when no appropriate method is defined. \withsubitem{(mapping object method)}{\ttindex{__getitem__()}} +When implementing a class that emulates any built-in type, it is +important that the emulation only be implemented to the degree that it +makes sense for the object being modelled. For example, some +sequences may work well with retrieval of individual elements, but +extracting a slice may not make sense. (One example of this is the +\class{NodeList} interface in the W3C's Document Object Model.) + \subsection{Basic customization\label{customization}} |