Commits

Anonymous committed bbbf176

added index entries for __*__ identifiers

  • Participants
  • Parent commits d69954e
  • Branches legacy-trunk

Comments (0)

Files changed (6)

File Doc/ref/ref3.tex

 class, then \verb@x[i]@ is equivalent to \verb@x.__getitem__(i)@.
 (The reverse is not true --- if \verb@x@ is a list object,
 \verb@x.__getitem__(i)@ is not equivalent to \verb@x[i]@.)
+\ttindex{__getitem__}
 
 Except for \verb@__repr__@, \verb@__str__@ and \verb@__cmp__@,
 attempts to execute an
 For \verb@__cmp__@, the default is to compare instances based on their
 address.
 For \verb@__str__@, the default is to use \verb@__repr__@.
+\ttindex{__repr__}
+\ttindex{__str__}
+\ttindex{__cmp__}
 
 
 \subsection{Special methods for any type}
 \code{__init__} method the derived class's \code{__init__} method must
 explicitly call it to ensure proper initialization of the base class
 part of the instance.
+\ttindex{__init__}
+\indexii{class}{constructor}
+
 
 \item[{\tt __del__(self)}]
 Called when the instance is about to be destroyed.  If a base class
 reference is deleted.  It is not guaranteed that
 \code{__del__} methods are called for objects that still exist when
 the interpreter exits.
+\ttindex{__del__}
+\stindex{del}
 
 Note that \code{del x} doesn't directly call \code{x.__del__} --- the
 former decrements the reference count for \code{x} by one, but
 \item[{\tt __repr__(self)}]
 Called by the \verb@repr()@ built-in function and by string conversions
 (reverse or backward quotes) to compute the string representation of an object.
+\ttindex{__repr__}
+\bifuncindex{repr}
 \indexii{string}{conversion}
 \indexii{reverse}{quotes}
 \indexii{backward}{quotes}
 \item[{\tt __str__(self)}]
 Called by the \verb@str()@ built-in function and by the \verb@print@
 statement compute the string representation of an object.
+\ttindex{__str__}
+\bifuncindex{str}
+\stindex{print}
 
 \item[{\tt __cmp__(self, other)}]
 Called by all comparison operations.  Should return -1 if
 (Implementation note: due to limitations in the interpreter,
 exceptions raised by comparisons are ignored, and the objects will be
 considered equal in this case.)
+\ttindex{__cmp__}
+\bifuncindex{cmp}
+\index{comparisons}
 
 \item[{\tt __hash__(self)}]
 Called for the key object for dictionary operations,
 \code{__hash__}, since the dictionary implementation assumes that a
 key's hash value is a constant.
 \obindex{dictionary}
+\ttindex{__cmp__}
+\ttindex{__hash__}
+\bifuncindex{hash}
 
 \item[{\tt __call__(self, *args)}]
 Called when the instance is ``called'' as a function.
+\ttindex{__call__}
+\indexii{call}{instance}
 
 \end{description}
 
 Called when an attribute lookup has not found the attribute in the
 usual places (i.e. it is not an instance attribute nor is it found in
 the class tree for \code{self}).  \code{name} is the attribute name.
+\ttindex{__getattr__}
 
 Note that if the attribute is found through the normal mechanism,
 \code{__getattr__} is not called.  (This is an asymmetry between
 Note that at least for instance variables, \code{__getattr__} can fake
 total control by simply not inserting any values in the instance
 attribute dictionary.
+\ttindex{__setattr__}
 
 \item[{\tt __setattr__(self, name, value)}]
 Called when an attribute assignment is attempted.  This is called
 instead of the normal mechanism (i.e. store the value as an instance
 attribute).  \code{name} is the attribute name, \code{value} is the
 value to be assigned to it.
+\ttindex{__setattr__}
 
 If \code{__setattr__} wants to assign to an instance attribute, it
 should not simply execute \code{self.\var{name} = value} --- this would
 cause a recursive call.  Instead, it should insert the value in the
 dictionary of instance attributes, e.g. \code{self.__dict__[name] =
 value}.
+\ttindex{__dict__}
 
 \item[{\tt __delattr__(self, name)}]
 Like \code{__setattr__} but for attribute deletion instead of
 assignment.
+\ttindex{__delattr__}
 
 \end{description}
 
 the length of the object, an integer \verb@>=@ 0.  Also, an object
 whose \verb@__len__()@ method returns 0 is considered to be false in a
 Boolean context.
+\ttindex{__len__}
 
 \item[{\tt __getitem__(self, key)}]
 Called to implement evaluation of \verb@self[key]@.  Note that the
 special interpretation of negative keys (if the class wishes to
 emulate a sequence type) is up to the \verb@__getitem__@ method.
+\ttindex{__getitem__}
 
 \item[{\tt __setitem__(self, key, value)}]
 Called to implement assignment to \verb@self[key]@.  Same note as for
 \verb@__getitem__@.
+\ttindex{__setitem__}
 
 \item[{\tt __delitem__(self, key)}]
 Called to implement deletion of \verb@self[key]@.  Same note as for
 \verb@__getitem__@.
+\ttindex{__delitem__}
 
 \end{description}
 
 respectively, and \verb@len(self)@ has been added (once) to originally
 negative \verb@i@ or \verb@j@ by the time this function is called
 (unlike for \verb@__getitem__@).
+\ttindex{__getslice__}
 
 \item[{\tt __setslice__(self, i, j, sequence)}]
 Called to implement assignment to \verb@self[i:j]@.  Same notes as for
 \verb@__getslice__@.
+\ttindex{__setslice__}
 
 \item[{\tt __delslice__(self, i, j)}]
 Called to implement deletion of \verb@self[i:j]@.  Same notes as for
 \verb@__getslice__@.
+\ttindex{__delslice__}
 
 \end{description}
 
 Called to implement the binary arithmetic operations (\verb@+@,
 \verb@-@, \verb@*@, \verb@/@, \verb@%@, \verb@divmod()@, \verb@pow()@,
 \verb@<<@, \verb@>>@, \verb@&@, \verb@^@, \verb@|@).
+\ttindex{__or__}
+\ttindex{__xor__}
+\ttindex{__and__}
+\ttindex{__rshift__}
+\ttindex{__lshift__}
+\ttindex{__pow__}
+\ttindex{__divmod__}
+\ttindex{__mod__}
+\ttindex{__div__}
+\ttindex{__mul__}
+\ttindex{__sub__}
+\ttindex{__add__}
 
 \item[{\tt __neg__(self)}]\itemjoin
 \item[{\tt __pos__(self)}]\itemjoin
 \item[{\tt __invert__(self)}]\itembreak
 Called to implement the unary arithmetic operations (\verb@-@, \verb@+@,
 \verb@abs()@ and \verb@~@).
+\ttindex{__invert__}
+\ttindex{__abs__}
+\ttindex{__pos__}
+\ttindex{__neg__}
 
 \item[{\tt __nonzero__(self)}]
 Called to implement boolean testing; should return 0 or 1.  An
 alternative name for this method is \verb@__len__@.
+\ttindex{__nonzero__}
 
 \item[{\tt __coerce__(self, other)}]
 Called to implement ``mixed-mode'' numeric arithmetic.  Should either
 interpreter will also ask the other object to attempt a coercion (but
 sometimes, if the implementation of the other type cannot be changed,
 it is useful to do the conversion to the other type here).
+\ttindex{__coerce__}
 
 Note that this method is not called to coerce the arguments to \verb@+@
 and \verb@*@, because these are also used to implement sequence
 \footnote{The interpreter should really distinguish between
 user-defined classes implementing sequences, mappings or numbers, but
 currently it doesn't --- hence this strange exception.}
+\ttindex{__mul__}
 
 \item[{\tt __int__(self)}]\itemjoin
 \item[{\tt __long__(self)}]\itemjoin
 \item[{\tt __float__(self)}]\itembreak
 Called to implement the built-in functions \verb@int()@, \verb@long()@
 and \verb@float()@.  Should return a value of the appropriate type.
+\ttindex{__float__}
+\ttindex{__long__}
+\ttindex{__int__}
 
 \item[{\tt __oct__(self)}]\itemjoin
 \item[{\tt __hex__(self)}]\itembreak
 Called to implement the built-in functions \verb@oct()@ and
 \verb@hex()@.  Should return a string value.
+\ttindex{__hex__}
+\ttindex{__oct__}
 
 \end{description}

File Doc/ref/ref4.tex

 explicitly mentioned in a {\tt global} statement change subtly: name
 lookup first searches the local name space, then the global one, then
 the built-in one.}
+\bimodindex{__builtin__}
+\stindex{from}
+\stindex{exec}
+\stindex{global}
+\ttindex{NameError}
 
 The following table lists the meaning of the local and global name
 space for various types of code blocks.  The name space for a
 \hline
 \end{tabular}
 \end{center}
+\bimodindex{__main__}
 
 Notes:
 

File Doc/ref/ref8.tex

 is identical to that of a complete program; each statement is executed
 in the name space of \verb@__main__@.
 \index{interactive mode}
+\bimodindex{__main__}
 
 Under {\UNIX}, a complete program can be passed to the interpreter in
 three forms: with the {\bf -c} {\it string} command line option, as a

File Doc/ref3.tex

 class, then \verb@x[i]@ is equivalent to \verb@x.__getitem__(i)@.
 (The reverse is not true --- if \verb@x@ is a list object,
 \verb@x.__getitem__(i)@ is not equivalent to \verb@x[i]@.)
+\ttindex{__getitem__}
 
 Except for \verb@__repr__@, \verb@__str__@ and \verb@__cmp__@,
 attempts to execute an
 For \verb@__cmp__@, the default is to compare instances based on their
 address.
 For \verb@__str__@, the default is to use \verb@__repr__@.
+\ttindex{__repr__}
+\ttindex{__str__}
+\ttindex{__cmp__}
 
 
 \subsection{Special methods for any type}
 \code{__init__} method the derived class's \code{__init__} method must
 explicitly call it to ensure proper initialization of the base class
 part of the instance.
+\ttindex{__init__}
+\indexii{class}{constructor}
+
 
 \item[{\tt __del__(self)}]
 Called when the instance is about to be destroyed.  If a base class
 reference is deleted.  It is not guaranteed that
 \code{__del__} methods are called for objects that still exist when
 the interpreter exits.
+\ttindex{__del__}
+\stindex{del}
 
 Note that \code{del x} doesn't directly call \code{x.__del__} --- the
 former decrements the reference count for \code{x} by one, but
 \item[{\tt __repr__(self)}]
 Called by the \verb@repr()@ built-in function and by string conversions
 (reverse or backward quotes) to compute the string representation of an object.
+\ttindex{__repr__}
+\bifuncindex{repr}
 \indexii{string}{conversion}
 \indexii{reverse}{quotes}
 \indexii{backward}{quotes}
 \item[{\tt __str__(self)}]
 Called by the \verb@str()@ built-in function and by the \verb@print@
 statement compute the string representation of an object.
+\ttindex{__str__}
+\bifuncindex{str}
+\stindex{print}
 
 \item[{\tt __cmp__(self, other)}]
 Called by all comparison operations.  Should return -1 if
 (Implementation note: due to limitations in the interpreter,
 exceptions raised by comparisons are ignored, and the objects will be
 considered equal in this case.)
+\ttindex{__cmp__}
+\bifuncindex{cmp}
+\index{comparisons}
 
 \item[{\tt __hash__(self)}]
 Called for the key object for dictionary operations,
 \code{__hash__}, since the dictionary implementation assumes that a
 key's hash value is a constant.
 \obindex{dictionary}
+\ttindex{__cmp__}
+\ttindex{__hash__}
+\bifuncindex{hash}
 
 \item[{\tt __call__(self, *args)}]
 Called when the instance is ``called'' as a function.
+\ttindex{__call__}
+\indexii{call}{instance}
 
 \end{description}
 
 Called when an attribute lookup has not found the attribute in the
 usual places (i.e. it is not an instance attribute nor is it found in
 the class tree for \code{self}).  \code{name} is the attribute name.
+\ttindex{__getattr__}
 
 Note that if the attribute is found through the normal mechanism,
 \code{__getattr__} is not called.  (This is an asymmetry between
 Note that at least for instance variables, \code{__getattr__} can fake
 total control by simply not inserting any values in the instance
 attribute dictionary.
+\ttindex{__setattr__}
 
 \item[{\tt __setattr__(self, name, value)}]
 Called when an attribute assignment is attempted.  This is called
 instead of the normal mechanism (i.e. store the value as an instance
 attribute).  \code{name} is the attribute name, \code{value} is the
 value to be assigned to it.
+\ttindex{__setattr__}
 
 If \code{__setattr__} wants to assign to an instance attribute, it
 should not simply execute \code{self.\var{name} = value} --- this would
 cause a recursive call.  Instead, it should insert the value in the
 dictionary of instance attributes, e.g. \code{self.__dict__[name] =
 value}.
+\ttindex{__dict__}
 
 \item[{\tt __delattr__(self, name)}]
 Like \code{__setattr__} but for attribute deletion instead of
 assignment.
+\ttindex{__delattr__}
 
 \end{description}
 
 the length of the object, an integer \verb@>=@ 0.  Also, an object
 whose \verb@__len__()@ method returns 0 is considered to be false in a
 Boolean context.
+\ttindex{__len__}
 
 \item[{\tt __getitem__(self, key)}]
 Called to implement evaluation of \verb@self[key]@.  Note that the
 special interpretation of negative keys (if the class wishes to
 emulate a sequence type) is up to the \verb@__getitem__@ method.
+\ttindex{__getitem__}
 
 \item[{\tt __setitem__(self, key, value)}]
 Called to implement assignment to \verb@self[key]@.  Same note as for
 \verb@__getitem__@.
+\ttindex{__setitem__}
 
 \item[{\tt __delitem__(self, key)}]
 Called to implement deletion of \verb@self[key]@.  Same note as for
 \verb@__getitem__@.
+\ttindex{__delitem__}
 
 \end{description}
 
 respectively, and \verb@len(self)@ has been added (once) to originally
 negative \verb@i@ or \verb@j@ by the time this function is called
 (unlike for \verb@__getitem__@).
+\ttindex{__getslice__}
 
 \item[{\tt __setslice__(self, i, j, sequence)}]
 Called to implement assignment to \verb@self[i:j]@.  Same notes as for
 \verb@__getslice__@.
+\ttindex{__setslice__}
 
 \item[{\tt __delslice__(self, i, j)}]
 Called to implement deletion of \verb@self[i:j]@.  Same notes as for
 \verb@__getslice__@.
+\ttindex{__delslice__}
 
 \end{description}
 
 Called to implement the binary arithmetic operations (\verb@+@,
 \verb@-@, \verb@*@, \verb@/@, \verb@%@, \verb@divmod()@, \verb@pow()@,
 \verb@<<@, \verb@>>@, \verb@&@, \verb@^@, \verb@|@).
+\ttindex{__or__}
+\ttindex{__xor__}
+\ttindex{__and__}
+\ttindex{__rshift__}
+\ttindex{__lshift__}
+\ttindex{__pow__}
+\ttindex{__divmod__}
+\ttindex{__mod__}
+\ttindex{__div__}
+\ttindex{__mul__}
+\ttindex{__sub__}
+\ttindex{__add__}
 
 \item[{\tt __neg__(self)}]\itemjoin
 \item[{\tt __pos__(self)}]\itemjoin
 \item[{\tt __invert__(self)}]\itembreak
 Called to implement the unary arithmetic operations (\verb@-@, \verb@+@,
 \verb@abs()@ and \verb@~@).
+\ttindex{__invert__}
+\ttindex{__abs__}
+\ttindex{__pos__}
+\ttindex{__neg__}
 
 \item[{\tt __nonzero__(self)}]
 Called to implement boolean testing; should return 0 or 1.  An
 alternative name for this method is \verb@__len__@.
+\ttindex{__nonzero__}
 
 \item[{\tt __coerce__(self, other)}]
 Called to implement ``mixed-mode'' numeric arithmetic.  Should either
 interpreter will also ask the other object to attempt a coercion (but
 sometimes, if the implementation of the other type cannot be changed,
 it is useful to do the conversion to the other type here).
+\ttindex{__coerce__}
 
 Note that this method is not called to coerce the arguments to \verb@+@
 and \verb@*@, because these are also used to implement sequence
 \footnote{The interpreter should really distinguish between
 user-defined classes implementing sequences, mappings or numbers, but
 currently it doesn't --- hence this strange exception.}
+\ttindex{__mul__}
 
 \item[{\tt __int__(self)}]\itemjoin
 \item[{\tt __long__(self)}]\itemjoin
 \item[{\tt __float__(self)}]\itembreak
 Called to implement the built-in functions \verb@int()@, \verb@long()@
 and \verb@float()@.  Should return a value of the appropriate type.
+\ttindex{__float__}
+\ttindex{__long__}
+\ttindex{__int__}
 
 \item[{\tt __oct__(self)}]\itemjoin
 \item[{\tt __hex__(self)}]\itembreak
 Called to implement the built-in functions \verb@oct()@ and
 \verb@hex()@.  Should return a string value.
+\ttindex{__hex__}
+\ttindex{__oct__}
 
 \end{description}

File Doc/ref4.tex

 explicitly mentioned in a {\tt global} statement change subtly: name
 lookup first searches the local name space, then the global one, then
 the built-in one.}
+\bimodindex{__builtin__}
+\stindex{from}
+\stindex{exec}
+\stindex{global}
+\ttindex{NameError}
 
 The following table lists the meaning of the local and global name
 space for various types of code blocks.  The name space for a
 \hline
 \end{tabular}
 \end{center}
+\bimodindex{__main__}
 
 Notes:
 

File Doc/ref8.tex

 is identical to that of a complete program; each statement is executed
 in the name space of \verb@__main__@.
 \index{interactive mode}
+\bimodindex{__main__}
 
 Under {\UNIX}, a complete program can be passed to the interpreter in
 three forms: with the {\bf -c} {\it string} command line option, as a