]> granicus.if.org Git - python/commitdiff
Added a note that objects which emulate built-in types should only
authorFred Drake <fdrake@acm.org>
Thu, 7 Dec 2000 04:49:34 +0000 (04:49 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 7 Dec 2000 04:49:34 +0000 (04:49 +0000)
implement as many of the relevant methods as make sense for the particular
information being modelled.

Doc/ref/ref3.tex

index 905a001784d18f685f1ac982c390b8123b182ed6..022211067f02dc3c318652b105b0f833a5aeeaf6 100644 (file)
@@ -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}}