mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Add change notes where im_class is discussed, since the exact meaning changes
with Python 2.2.
This commit is contained in:
		
							parent
							
								
									b62f0e1a7b
								
							
						
					
					
						commit
						f9d580346b
					
				
					 2 changed files with 60 additions and 49 deletions
				
			
		| 
						 | 
					@ -30,62 +30,71 @@ provided as convenient choices for the second argument to
 | 
				
			||||||
\function{getmembers()}.  They also help you determine when
 | 
					\function{getmembers()}.  They also help you determine when
 | 
				
			||||||
you can expect to find the following special attributes:
 | 
					you can expect to find the following special attributes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\begin{tableiii}{c|l|l}{}{Type}{Attribute}{Description}
 | 
					\begin{tableiv}{c|l|l|c}{}{Type}{Attribute}{Description}{Notes}
 | 
				
			||||||
  \lineiii{module}{__doc__}{documentation string}
 | 
					  \lineiv{module}{__doc__}{documentation string}{}
 | 
				
			||||||
  \lineiii{}{__file__}{filename (missing for built-in modules)}
 | 
					  \lineiv{}{__file__}{filename (missing for built-in modules)}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{class}{__doc__}{documentation string}
 | 
					  \lineiv{class}{__doc__}{documentation string}{}
 | 
				
			||||||
  \lineiii{}{__module__}{name of module in which this class was defined}
 | 
					  \lineiv{}{__module__}{name of module in which this class was defined}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{method}{__doc__}{documentation string}
 | 
					  \lineiv{method}{__doc__}{documentation string}{}
 | 
				
			||||||
  \lineiii{}{__name__}{name with which this method was defined}
 | 
					  \lineiv{}{__name__}{name with which this method was defined}{}
 | 
				
			||||||
  \lineiii{}{im_class}{class object that asked for this method}
 | 
					  \lineiv{}{im_class}{class object that asked for this method}{(1)}
 | 
				
			||||||
  \lineiii{}{im_func}{function object containing implementation of method}
 | 
					  \lineiv{}{im_func}{function object containing implementation of method}{}
 | 
				
			||||||
  \lineiii{}{im_self}{instance to which this method is bound, or \code{None}}
 | 
					  \lineiv{}{im_self}{instance to which this method is bound, or \code{None}}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{function}{__doc__}{documentation string}
 | 
					  \lineiv{function}{__doc__}{documentation string}{}
 | 
				
			||||||
  \lineiii{}{__name__}{name with which this function was defined}
 | 
					  \lineiv{}{__name__}{name with which this function was defined}{}
 | 
				
			||||||
  \lineiii{}{func_code}{code object containing compiled function bytecode}
 | 
					  \lineiv{}{func_code}{code object containing compiled function bytecode}{}
 | 
				
			||||||
  \lineiii{}{func_defaults}{tuple of any default values for arguments}
 | 
					  \lineiv{}{func_defaults}{tuple of any default values for arguments}{}
 | 
				
			||||||
  \lineiii{}{func_doc}{(same as __doc__)}
 | 
					  \lineiv{}{func_doc}{(same as __doc__)}{}
 | 
				
			||||||
  \lineiii{}{func_globals}{global namespace in which this function was defined}
 | 
					  \lineiv{}{func_globals}{global namespace in which this function was defined}{}
 | 
				
			||||||
  \lineiii{}{func_name}{(same as __name__)}
 | 
					  \lineiv{}{func_name}{(same as __name__)}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{traceback}{tb_frame}{frame object at this level}
 | 
					  \lineiv{traceback}{tb_frame}{frame object at this level}{}
 | 
				
			||||||
  \lineiii{}{tb_lasti}{index of last attempted instruction in bytecode}
 | 
					  \lineiv{}{tb_lasti}{index of last attempted instruction in bytecode}{}
 | 
				
			||||||
  \lineiii{}{tb_lineno}{current line number in Python source code}
 | 
					  \lineiv{}{tb_lineno}{current line number in Python source code}{}
 | 
				
			||||||
  \lineiii{}{tb_next}{next inner traceback object (called by this level)}
 | 
					  \lineiv{}{tb_next}{next inner traceback object (called by this level)}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{frame}{f_back}{next outer frame object (this frame's caller)}
 | 
					  \lineiv{frame}{f_back}{next outer frame object (this frame's caller)}{}
 | 
				
			||||||
  \lineiii{}{f_builtins}{built-in namespace seen by this frame}
 | 
					  \lineiv{}{f_builtins}{built-in namespace seen by this frame}{}
 | 
				
			||||||
  \lineiii{}{f_code}{code object being executed in this frame}
 | 
					  \lineiv{}{f_code}{code object being executed in this frame}{}
 | 
				
			||||||
  \lineiii{}{f_exc_traceback}{traceback if raised in this frame, or \code{None}}
 | 
					  \lineiv{}{f_exc_traceback}{traceback if raised in this frame, or \code{None}}{}
 | 
				
			||||||
  \lineiii{}{f_exc_type}{exception type if raised in this frame, or \code{None}}
 | 
					  \lineiv{}{f_exc_type}{exception type if raised in this frame, or \code{None}}{}
 | 
				
			||||||
  \lineiii{}{f_exc_value}{exception value if raised in this frame, or \code{None}}
 | 
					  \lineiv{}{f_exc_value}{exception value if raised in this frame, or \code{None}}{}
 | 
				
			||||||
  \lineiii{}{f_globals}{global namespace seen by this frame}
 | 
					  \lineiv{}{f_globals}{global namespace seen by this frame}{}
 | 
				
			||||||
  \lineiii{}{f_lasti}{index of last attempted instruction in bytecode}
 | 
					  \lineiv{}{f_lasti}{index of last attempted instruction in bytecode}{}
 | 
				
			||||||
  \lineiii{}{f_lineno}{current line number in Python source code}
 | 
					  \lineiv{}{f_lineno}{current line number in Python source code}{}
 | 
				
			||||||
  \lineiii{}{f_locals}{local namespace seen by this frame}
 | 
					  \lineiv{}{f_locals}{local namespace seen by this frame}{}
 | 
				
			||||||
  \lineiii{}{f_restricted}{0 or 1 if frame is in restricted execution mode}
 | 
					  \lineiv{}{f_restricted}{0 or 1 if frame is in restricted execution mode}{}
 | 
				
			||||||
  \lineiii{}{f_trace}{tracing function for this frame, or \code{None}}
 | 
					  \lineiv{}{f_trace}{tracing function for this frame, or \code{None}}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{code}{co_argcount}{number of arguments (not including * or ** args)}
 | 
					  \lineiv{code}{co_argcount}{number of arguments (not including * or ** args)}{}
 | 
				
			||||||
  \lineiii{}{co_code}{string of raw compiled bytecode}
 | 
					  \lineiv{}{co_code}{string of raw compiled bytecode}{}
 | 
				
			||||||
  \lineiii{}{co_consts}{tuple of constants used in the bytecode}
 | 
					  \lineiv{}{co_consts}{tuple of constants used in the bytecode}{}
 | 
				
			||||||
  \lineiii{}{co_filename}{name of file in which this code object was created}
 | 
					  \lineiv{}{co_filename}{name of file in which this code object was created}{}
 | 
				
			||||||
  \lineiii{}{co_firstlineno}{number of first line in Python source code}
 | 
					  \lineiv{}{co_firstlineno}{number of first line in Python source code}{}
 | 
				
			||||||
  \lineiii{}{co_flags}{bitmap: 1=optimized \code{|} 2=newlocals \code{|} 4=*arg \code{|} 8=**arg}
 | 
					  \lineiv{}{co_flags}{bitmap: 1=optimized \code{|} 2=newlocals \code{|} 4=*arg \code{|} 8=**arg}{}
 | 
				
			||||||
  \lineiii{}{co_lnotab}{encoded mapping of line numbers to bytecode indices}
 | 
					  \lineiv{}{co_lnotab}{encoded mapping of line numbers to bytecode indices}{}
 | 
				
			||||||
  \lineiii{}{co_name}{name with which this code object was defined}
 | 
					  \lineiv{}{co_name}{name with which this code object was defined}{}
 | 
				
			||||||
  \lineiii{}{co_names}{tuple of names of local variables}
 | 
					  \lineiv{}{co_names}{tuple of names of local variables}{}
 | 
				
			||||||
  \lineiii{}{co_nlocals}{number of local variables}
 | 
					  \lineiv{}{co_nlocals}{number of local variables}{}
 | 
				
			||||||
  \lineiii{}{co_stacksize}{virtual machine stack space required}
 | 
					  \lineiv{}{co_stacksize}{virtual machine stack space required}{}
 | 
				
			||||||
  \lineiii{}{co_varnames}{tuple of names of arguments and local variables}
 | 
					  \lineiv{}{co_varnames}{tuple of names of arguments and local variables}{}
 | 
				
			||||||
  \hline
 | 
					  \hline
 | 
				
			||||||
  \lineiii{builtin}{__doc__}{documentation string}
 | 
					  \lineiv{builtin}{__doc__}{documentation string}{}
 | 
				
			||||||
  \lineiii{}{__name__}{original name of this function or method}
 | 
					  \lineiv{}{__name__}{original name of this function or method}{}
 | 
				
			||||||
  \lineiii{}{__self__}{instance to which a method is bound, or \code{None}}
 | 
					  \lineiv{}{__self__}{instance to which a method is bound, or \code{None}}{}
 | 
				
			||||||
\end{tableiii}
 | 
					\end{tableiv}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\noindent
 | 
				
			||||||
 | 
					Note:
 | 
				
			||||||
 | 
					\begin{description}
 | 
				
			||||||
 | 
					\item[(1)]
 | 
				
			||||||
 | 
					\versionchanged[\member{im_class} used to refer to the class that
 | 
				
			||||||
 | 
					                defined the method]{2.2}
 | 
				
			||||||
 | 
					\end{description}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\begin{funcdesc}{getmembers}{object\optional{, predicate}}
 | 
					\begin{funcdesc}{getmembers}{object\optional{, predicate}}
 | 
				
			||||||
  Return all the members of an object in a list of (name, value) pairs
 | 
					  Return all the members of an object in a list of (name, value) pairs
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -452,6 +452,8 @@ or the class that asked for the method for unbound methods);
 | 
				
			||||||
\member{__doc__} is the method's documentation (same as
 | 
					\member{__doc__} is the method's documentation (same as
 | 
				
			||||||
\code{im_func.__doc__}); \member{__name__} is the method name (same as
 | 
					\code{im_func.__doc__}); \member{__name__} is the method name (same as
 | 
				
			||||||
\code{im_func.__name__}).
 | 
					\code{im_func.__name__}).
 | 
				
			||||||
 | 
					\versionchanged[\member{im_self} used to refer to the class that
 | 
				
			||||||
 | 
					                defined the method]{2.2}
 | 
				
			||||||
\withsubitem{(method attribute)}{
 | 
					\withsubitem{(method attribute)}{
 | 
				
			||||||
  \ttindex{im_func}
 | 
					  \ttindex{im_func}
 | 
				
			||||||
  \ttindex{im_self}}
 | 
					  \ttindex{im_self}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue