summaryrefslogtreecommitdiff
path: root/Lib/types.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-14 20:41:17 +0000
committerGuido van Rossum <guido@python.org>2002-06-14 20:41:17 +0000
commitbea18ccde6bc12e061c21bb6b944379d8b123845 (patch)
treed5366d2bba31bde0cf6d05e1b55cde64cf3d3864 /Lib/types.py
parent57454e57f83b407dd2653cbfcead7c9801beeff0 (diff)
downloadcpython-git-bea18ccde6bc12e061c21bb6b944379d8b123845.tar.gz
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]
Diffstat (limited to 'Lib/types.py')
-rw-r--r--Lib/types.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/types.py b/Lib/types.py
index da0e597487..fc0fbfb401 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -23,13 +23,17 @@ except NameError:
pass
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
StringTypes = (StringType, UnicodeType)
except NameError:
StringTypes = (StringType,)
-BufferType = type(buffer(''))
+BufferType = buffer
TupleType = tuple
ListType = list
@@ -77,7 +81,7 @@ except TypeError:
pass
tb = None; del tb
-SliceType = type(slice(0))
+SliceType = slice
EllipsisType = type(Ellipsis)
DictProxyType = type(TypeType.__dict__)