[Python-checkins] python/dist/src/Lib types.py,1.28,1.29
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 14 Jun 2002 13:41:45 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv18223/Lib
Modified Files:
types.py
Log Message:
SF patch 568629 by Oren Tirosh: types made callable.
These built-in functions are replaced by their (now callable) type:
slice()
buffer()
and these types can also be called (but have no built-in named
function named after them)
classobj (type name used to be "class")
code
function
instance
instancemethod (type name used to be "instance method")
The module "new" has been replaced with a small backward compatibility
placeholder in Python.
A large portion of the patch simply removes the new module from
various platform-specific build recipes. The following binary Mac
project files still have references to it:
Mac/Build/PythonCore.mcp
Mac/Build/PythonStandSmall.mcp
Mac/Build/PythonStandalone.mcp
[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring. --Guido]
Index: types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** types.py 5 Jun 2002 23:12:44 -0000 1.28
--- types.py 14 Jun 2002 20:41:13 -0000 1.29
***************
*** 24,27 ****
--- 24,31 ----
StringType = str
+
+ # StringTypes is already outdated. Instead of writing "type(x) in
+ # types.StringTypes", you should use "isinstance(x, basestring)". But
+ # we keep around for compatibility with Python 2.2.
try:
UnicodeType = unicode
***************
*** 30,34 ****
StringTypes = (StringType,)
! BufferType = type(buffer(''))
TupleType = tuple
--- 34,38 ----
StringTypes = (StringType,)
! BufferType = buffer
TupleType = tuple
***************
*** 78,82 ****
tb = None; del tb
! SliceType = type(slice(0))
EllipsisType = type(Ellipsis)
--- 82,86 ----
tb = None; del tb
! SliceType = slice
EllipsisType = type(Ellipsis)