[Python-checkins] CVS: python/dist/src/Lib inspect.py,1.20,1.21

Tim Peters tim_one@users.sourceforge.net
Sun, 16 Sep 2001 01:40:19 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv32622/python/dist/src/Lib

Modified Files:
	inspect.py 
Log Message:
In a world with a growing number of subclassable types, replace
    type(x) is T
tests with
    isinstance(x, T)
Also got rid of a future-generators import, left over from code that
wasn't intended to get checked in.


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** inspect.py	2001/09/04 19:14:13	1.20
--- inspect.py	2001/09/16 08:40:16	1.21
***************
*** 25,30 ****
  # This module is in the public domain.  No warranties.
  
- from __future__ import generators
- 
  __author__ = 'Ka-Ping Yee <ping@lfw.org>'
  __date__ = '1 Jan 2001'
--- 25,28 ----
***************
*** 39,43 ****
          __doc__         documentation string
          __file__        filename (missing for built-in modules)"""
!     return type(object) is types.ModuleType
  
  def isclass(object):
--- 37,41 ----
          __doc__         documentation string
          __file__        filename (missing for built-in modules)"""
!     return isinstance(object, types.ModuleType)
  
  def isclass(object):
***************
*** 47,51 ****
          __doc__         documentation string
          __module__      name of module in which this class was defined"""
!     return type(object) is types.ClassType or hasattr(object, '__bases__')
  
  def ismethod(object):
--- 45,49 ----
          __doc__         documentation string
          __module__      name of module in which this class was defined"""
!     return isinstance(object, types.ClassType) or hasattr(object, '__bases__')
  
  def ismethod(object):
***************
*** 58,62 ****
          im_func         function object containing implementation of method
          im_self         instance to which this method is bound, or None"""
!     return type(object) is types.MethodType
  
  def isfunction(object):
--- 56,60 ----
          im_func         function object containing implementation of method
          im_self         instance to which this method is bound, or None"""
!     return isinstance(object, types.MethodType)
  
  def isfunction(object):
***************
*** 71,75 ****
          func_globals    global namespace in which this function was defined
          func_name       (same as __name__)"""
!     return type(object) in [types.FunctionType, types.LambdaType]
  
  def istraceback(object):
--- 69,73 ----
          func_globals    global namespace in which this function was defined
          func_name       (same as __name__)"""
!     return isinstance(object, types.FunctionType)
  
  def istraceback(object):
***************
*** 81,85 ****
          tb_lineno       current line number in Python source code
          tb_next         next inner traceback object (called by this level)"""
!     return type(object) is types.TracebackType
  
  def isframe(object):
--- 79,83 ----
          tb_lineno       current line number in Python source code
          tb_next         next inner traceback object (called by this level)"""
!     return isinstance(object, types.TracebackType)
  
  def isframe(object):
***************
*** 99,103 ****
          f_restricted    0 or 1 if frame is in restricted execution mode
          f_trace         tracing function for this frame, or None"""
!     return type(object) is types.FrameType
  
  def iscode(object):
--- 97,101 ----
          f_restricted    0 or 1 if frame is in restricted execution mode
          f_trace         tracing function for this frame, or None"""
!     return isinstance(object, types.FrameType)
  
  def iscode(object):
***************
*** 117,121 ****
          co_stacksize    virtual machine stack space required
          co_varnames     tuple of names of arguments and local variables"""
!     return type(object) is types.CodeType
  
  def isbuiltin(object):
--- 115,119 ----
          co_stacksize    virtual machine stack space required
          co_varnames     tuple of names of arguments and local variables"""
!     return isinstance(object, types.CodeType)
  
  def isbuiltin(object):
***************
*** 126,130 ****
          __name__        original name of this function or method
          __self__        instance to which a method is bound, or None"""
!     return type(object) is types.BuiltinFunctionType
  
  def isroutine(object):
--- 124,128 ----
          __name__        original name of this function or method
          __self__        instance to which a method is bound, or None"""
!     return isinstance(object, types.BuiltinFunctionType)
  
  def isroutine(object):